Beispiel #1
0
 def Is_Product_Added_To_Cart(self, driver, product_name):
     try:
         self.driver = driver
         BasePage.click(self, Locators.AddToCart.my_cart)
         return BasePage.Is_data_present_in_table(
             self, Locators.AddToCart.cart_table, product_name)
     except Exception as log:
         print("Error", log)
Beispiel #2
0
 def Add_To_Cart(self, driver, url):
     try:
         self.driver = driver
         self.driver.get(url)
         BasePage.click(self, Locators.AddToCart.add_to_cart)
         BasePage.is_invisible(self,
                               Locators.AddToCart.product_added_message_box)
     except Exception as log:
         print("Error", log)
Beispiel #3
0
 def checkout_registered_user(self, driver):
     try:
         self.driver = driver
         BasePage.click(self, Locators.AddToCart.checkout)
         BasePage.click(self, Locators.AddToCart.continue_checkout1)
         BasePage.click(self, Locators.AddToCart.ground_shipping)
         BasePage.click(self, Locators.AddToCart.continue_checkout2)
         BasePage.click(self, Locators.AddToCart.place_order)
     except Exception as log:
         print(log)
Beispiel #4
0
def start_watcher():
    base_page = BasePage()
    browser = base_page.browser

    login_page = LoginPage(browser)

    if login_page.check_if_is_not_logged_in():
        login_page.login({'phone_country': 55, 'phone_number': 31975325480})

    main_page = MainPage(browser)
    main_page.watch_channel('testedotelegra')
Beispiel #5
0
class GooglePage():

    basePage = BasePage()
    searchText = (By.ID, "lst-ib")
    searchResultList = (By.ID, "rso")
    searchResultLink = (
        By.XPATH,
        "//cite[@class='_Rm' and contains(.,'https://www.instawork.com/')]")
    searchResultBlock = (By.XPATH, "//div[@class='g']")
    searchResultLinkchild = (
        By.XPATH,
        ".//cite[@class='_Rm' and contains(.,'https://www.instawork.com/')]")

    footerPageLinks = (By.XPATH, "//div[@id='foot']//a")

    #Enter search term in search textbox
    def enterSearchTerm(self, driver, searchTerm):
        self.basePage.waitAndType(driver, searchTerm, self.searchText)

    #Press "Enter" key on search textbox
    def pressEnterKeySearchBox(self, driver):
        self.basePage.getElement(driver,
                                 self.searchText).send_keys(Keys.RETURN)
        self.basePage.waitForElement(driver, self.searchResultList)

    #Verify if search result is present in the result page
    def isSearchResultPresentInFirst(self, driver):
        return self.basePage.isElementPresent(driver, self.searchResultLink)

    # get the order(position) of search term in search result page
    def getOrderOfSearchResult(self, driver):

        self.basePage.waitForElement(driver, self.searchResultList)
        searchBlocks = self.basePage.getAllElements(driver,
                                                    self.searchResultBlock)

        for i in xrange(len(searchBlocks)):
            if self.basePage.isChildPresentInParent(
                    driver, searchBlocks[i],
                    self.searchResultLinkchild) is True:
                return i + 1
            else:
                continue

    #Get total number of search result pages
    def getNumberOfSearchPages(self, driver):
        return len(self.basePage.getAllElements(driver, self.footerPageLinks))

    def getAllPagelinks(self, driver):
        return self.basePage.getAllElements(driver, self.footerPageLinks)

    def clickOnPageLink(self, driver, pageLink):
        self.basePage.clickElement(pageLink)
 def signup(self,driver,emailid,password):
     try:
         self.driver = driver
         self.driver.get(SignUpPagelocators.url)
         BasePage.sendKeys(self,SignUpPagelocators.emailid,emailid)
         BasePage.sendKeys(self,SignUpPagelocators.password,password)
         BasePage.click(self,SignUpPagelocators.signuputton)
     except Exception as log:
         print("error occured : ",log)
Beispiel #7
0
 def Is_order_placed(self, driver):
     try:
         self.driver = driver
         return BasePage.is_visible(self, Locators.AddToCart.order_status)
     except Exception as log:
         print("Error", log)
Beispiel #8
0
 def checkout(self, driver, get_billing_address):
     try:
         self.driver = driver
         firstname, lastname, email, country, ZIPcode, state, city, address1, address2, contact = get_billing_address
         print(firstname, city)
         BasePage.click(self, Locators.AddToCart.checkout)
         BasePage.sendKeys(self, Locators.BillingAddress.email, email)
         BasePage.sendKeys(self, Locators.BillingAddress.firstname,
                           firstname)
         BasePage.sendKeys(self, Locators.BillingAddress.lastname, lastname)
         BasePage.sendKeys(self, Locators.BillingAddress.ZipCode,
                           int(ZIPcode))
         BasePage.sendKeys(self, Locators.BillingAddress.city, city)
         BasePage.sendKeys(self, Locators.BillingAddress.addressline1,
                           address1)
         BasePage.sendKeys(self, Locators.BillingAddress.addressline2,
                           address2)
         BasePage.sendKeys(self, Locators.BillingAddress.phone,
                           int(contact))
         BasePage.select_by_text(self, Locators.BillingAddress.country,
                                 country)
         BasePage.select_by_text(self, Locators.BillingAddress.state, state)
         BasePage.click(self, Locators.AddToCart.shipping_same_as_billing)
         BasePage.click(self, Locators.AddToCart.continue_checkout1)
         BasePage.click(self, Locators.AddToCart.ground_shipping)
         BasePage.click(self, Locators.AddToCart.continue_checkout2)
         BasePage.click(self, Locators.AddToCart.place_order)
     except Exception as log:
         print(log)
Beispiel #9
0
 def registration(self, driver, email, password, retypedpassword, firstname,
                  lastname, country, state, ZIPcode, city, address1,
                  address2, contact):
     try:
         self.driver = driver
         self.driver.get(NewRegistration.url)
         BasePage.sendKeys(self, NewRegistration.email, email)
         BasePage.sendKeys(self, NewRegistration.password, password)
         BasePage.sendKeys(self, NewRegistration.repassword,
                           retypedpassword)
         BasePage.sendKeys(self, NewRegistration.firstname, firstname)
         BasePage.sendKeys(self, NewRegistration.lastname, lastname)
         BasePage.sendKeys(self, NewRegistration.ZipCode, int(ZIPcode))
         BasePage.sendKeys(self, NewRegistration.city, city)
         BasePage.sendKeys(self, NewRegistration.addressline1, address1)
         BasePage.sendKeys(self, NewRegistration.addressline2, address2)
         BasePage.sendKeys(self, NewRegistration.phone, int(contact))
         BasePage.select_by_text(self, NewRegistration.country, country)
         BasePage.select_by_text(self, NewRegistration.state, state)
         BasePage.click(self, NewRegistration.registerbtn)
     except Exception as log:
         print(log)
Beispiel #10
0
 def is_registration_successful(self):
     return BasePage.is_visible(self, NewRegistration.myaccounttitle)
 def is_signup_successful(self):
     return BasePage.is_visible(self,SignUpPagelocators.myaccounttitle)