Esempio n. 1
0
    def test_e2e(self):

        log = self.getLogger()
        homepage = HomePage(self.driver)
        checkoutpage = homepage.shopItems()
        log.info("Getting all the Titles of items")
        products = checkoutpage.getProductsName()

        i = -1
        for product in products:
            i = i + 1
            productName = product.text
            log.info(productName)
            if productName == 'Blackberry':
                checkoutpage.add()[i].click()

        checkoutpage.checknow().click()
        addeditem = self.driver.find_element_by_link_text("Blackberry").text
        assert addeditem == 'Blackberry'

        Purchase = checkoutpage.confirmnow()
        log.info("Searching of India by entering ind in search box")
        Purchase.purchaseclick().send_keys('ind')
        self.verifyTextPresence("India")
        Purchase.sendingText().click()
        Purchase.clickcheckbox().click()
        Purchase.finalstep().click()

        message = Purchase.successMessage().text
        log.info("Text received is" + message)
        assert "Success! Thank you!" in message
Esempio n. 2
0
    def test_e2e(self):
        log = self.getLogger()
        homePage = HomePage(self.driver)
        checkoutpage = homePage.shopItems()
        log.info("getting all the card titles")
        cards = checkoutpage.getCardTitles()
        i = -1
        for card in cards:
            i = i + 1
            cardText = card.text
            log.info(cardText)
            if cardText == "Blackberry":
                checkoutpage.getCardFooter()[i].click()

        self.driver.find_element_by_css_selector(
            "a[class*='btn-primary']").click()

        confirmpage = checkoutpage.checkOutItems()
        log.info("Entering country name as ind")
        self.driver.find_element_by_id("country").send_keys("ind")
        #time.sleep(5)
        self.verifyLinkPresence("India")

        self.driver.find_element_by_link_text("India").click()
        self.driver.find_element_by_xpath(
            "//div[@class='checkbox checkbox-primary']").click()
        self.driver.find_element_by_css_selector("[type='submit']").click()
        textMatch = self.driver.find_element_by_css_selector(
            "[class*='alert-success']").text
        log.info("Text received from application is " + textMatch)

        assert ("Success! Thank you!" in textMatch)
Esempio n. 3
0
 def test_MobilePurchase(self):
     log = self.getLogger()
     log.info("Entering Samsung URL")
     self.samsungurl()
     homepage = HomePage(self.driver)
     log.info("Click on mobile option in navigation bar")
     homepage.mobile().click()
     log.info("Move mouse towards smartphones option")
     homepage.smartphones().click()
     log.info("Then click on SeeAll option")
     SeeAll = homepage.seeallmobiles()
     self.driver.execute_script("arguments[0].click();", SeeAll)
     selectionpage = SelectionPage(self.driver)
     log.info("List of all Mobile Brand")
     cards = selectionpage.mobilelist()
     try:
         for card in cards:
             log.info("Selecting one by one from that mobile list")
             ReqProduct = card.find_element_by_xpath("div/div[3]/a/p").text
             if ReqProduct == "Galaxy S21 5G":
                 log.info("Click on the required mobile product")
                 Abcd = card.find_element_by_xpath("div[2]/div[5]/a")
                 self.driver.execute_script("arguments[0].click();", Abcd)
                 log.info("Click on Add to Cart option")
                 confirmpage = selectionpage.addtocart()
                 log.info("Click on the Continue Option")
                 checkoutpage = confirmpage.continueoption()
                 log.info("Click on Remove Button")
                 checkoutpage.removebutton().click()
     except StaleElementReferenceException:
         pass
Esempio n. 4
0
    def test_formSubmission(self, getData):
        log = self.getLogger()
        homepage = HomePage(self.driver)
        homepage.getName().send_keys(getData["firstname"])
        log.info("firstname is entered")
        # driver.find_element_by_name("name").send_keys("Ticvic")
        time.sleep(5)
        homepage.getEmail().send_keys(getData["lastname"])
        log.info("lastname is entered")
        #driver.find_element_by_name("email").send_keys("*****@*****.**")
        time.sleep(3)
        #driver.find_element_by_id("exampleInputPassword1").send_keys("Password")
        homepage.getCheckBox().click()
        #it is reusable and define it in baseclass
        #sel = Select(homepage.getGender())
        #sel.select_by_visible_text("Male")

        self.selectOptionByText(homepage.getGender(), getData["gender"])
        log.critical("gender is selected")
        homepage.submitForm().click()

        alertText = homepage.getSuccessMessage().text
        #for refreshing and passing datas like data provider we use this.
        self.driver.refresh()

        assert ("Success" in alertText)
Esempio n. 5
0
    def test_formSubmission(self, getData):
        logs = self.getLogger()

        homePage = HomePage(self.driver)
        homePage.getName().send_keys(getData["Name"])
        logs.info("Name : "+getData["Name"])
        homePage.getEmail().send_keys(getData["Email"])
        logs.info("Email : "+getData["Email"])
        homePage.getPassword().send_keys(getData["Password"])
        logs.info("Password : "******"Password"])
        homePage.getIceCream().click()
        self.selectOptionByText(homePage.getGender(), getData["Gender"])
        logs.info("Gender : "+getData["Gender"])
        homePage.getEmployeeStatus().click()
        logs.info("IceCream : Checked")
        # homePage.getDateOfBirth().send_keys(getData["DOB"])
        # logs.info("Date Of Birth : "+getData["DOB"])
        homePage.getFormSubmit().click()
        logs.info("Submit")

        alertMsg = homePage.getSuccessMsg().text
        assert ("Success" in alertMsg)
        logs.info(alertMsg)

        self.driver.refresh()
Esempio n. 6
0
    def test_8_fileUpload(self):
        # Home page menu - JavaScript Alerts
        homePage = HomePage(self.driver)
        homePage.javaScriptAlerts().click()

        #Press button to display alert
        self.driver.find_element_by_xpath(
            "//*[@id='content']/div/ul/li[1]/button").click()
        time.sleep(2)
        # wait until 2 seconds

        #Displayed alert
        alert = self.driver.switch_to.alert
        time.sleep(2)
        # wait until 2 seconds

        #JavaScript alert
        alert.accept()
        self.driver.find_element_by_xpath(
            "//*[@id='content']/div/ul/li[3]/button").click()
        time.sleep(2)

        #Type "testing"
        testData = TestData()
        alert.send_keys(testData.getTextData()[0])
        time.sleep(2)
        # wait until 2 seconds

        #Typed "testing"
        alert.accept()
        time.sleep(2)
 def add(driver, contactName, contactEmail, isStar, contactPhone,
         contactComment):
     try:
         #创建主页实例
         hp = HomePage(driver)
         hp.addressLink().click()
         time.sleep(3)
         #创建联系人页面实例对象
         apb = AddressBookPage(driver)
         apb.createContactPersonButton().click()
         if contactName:
             #非必输项
             apb.contactPersonName().send_keys(contactName)
             #必输项
             apb.contactPersonEmail().send_keys(contactEmail)
         if isStar == u"是":
             apb.starContacts().click()
         if contactPhone:
             apb.contactPersonMoblie().send_keys(contactPhone)
         if contactComment:
             apb.contactPersonComment().send_keys(contactComment)
         apb.saveContacePerson().click()
     except Exception, e:
         print traceback.print_exc()
         raise e
Esempio n. 8
0
    def test_e2e(self):

        log = self.getlogger()
        homepage = HomePage(self.driver)  # Home page

        shoppingpage = homepage.shop_option()  # Shopping page
        log.info("Getting all the cards title")
        cards = shoppingpage.getcardtitles()
        for card in cards:
            cardText = card.text
            # print(cardText)
            log.info(cardText)
            if cardText == "Blackberry":
                shoppingpage.getcardfooterbtn().click()

        checkoutpage = shoppingpage.checkoutbtn()  # Checkout Page

        confirmpage = checkoutpage.finalcheckout()  # Confirm Page
        log.info("Entering Country name")
        confirmpage.confirm().send_keys("ind")
        # time.sleep(6)
        self.valifylinkpresence("India")
        confirmpage.select_country().click()

        confirmpage.clickcheckbox().click()
        confirmpage.clciksubmit().click()
        alerText = confirmpage.getalert().text
        # print(alerText)
        log.info(alerText)
        confirmpage.getscreenshot()
        assert "Success" in alerText
Esempio n. 9
0
    def test_EndtoEnd(self):
        log = self.getLogger()
        homePage = HomePage(self.driver)
        homePage.shopItems().click()

        checkOutPage = CheckoutPage(self.driver)
        products = checkOutPage.checkoutItems()

        for product in products:
            productName = product.find_element_by_xpath("div/h4/a").text
            log.info(productName)
            if productName == "Blackberry":
                product.find_element_by_xpath("div[2]/button").click()

        checkOutPage.checkoutButton().click()  # checkout proceed
        checkOutPage.checkoutFinalButton().click()  # Checkout Final

        confirmPage_Obj = ConfirmPage(self.driver)
        confirmPage_Obj.addressDropdown().send_keys("ind")
        # wait = WebDriverWait(self.driver, 8)
        # wait.until(expected_conditions.presence_of_element_located((By.LINK_TEXT, "India")))
        log.info("Country Selection")
        self.VerifyLinkPresence("India")  # Optimized in BaseClass
        confirmPage_Obj.addressSelection().click()
        confirmPage_Obj.purchaseButton().click()
        successText = confirmPage_Obj.successText().text
        log.info("Success Text : " + successText)

        assert "Success" in successText

        self.driver.get_screenshot_as_file("screenshot1.png")  # method to get screenshot
 def test_logout(self, getLoginData):
     home = HomePage(self.driver)
     wait = WaitUtil(self.driver)
     log = self.getlogger()
     log.info("login")
     home.getLoginLink().click()
     wait.waitforVisibilityofElement(home.loginPopUp)
     log.debug("login window opened")
     username = getLoginData.get("TestData", "email")
     password = getLoginData.get("TestData", "password")
     log.info("Loging in as user " + username)
     home.getUernameTextBox().clear()
     home.getUernameTextBox().send_keys(username)
     log.debug("Entered user name " + username)
     home.getPasswordTextBox().clear()
     home.getPasswordTextBox().send_keys(password)
     log.debug("entered password " + password)
     home.getLoginButton().click()
     wait.waitforVisibilityofElement(home.logOutLink)
     log.info("loging out")
     home.getLogOutLink().click()
     log.info("logout link was clicked")
     wait.waitforVisibilityofElement(home.loginLink)
     assert not home.getUernameTextBox().is_displayed(
     ), "user name is still present in home page"
     log.debug("logged out username is not visible in home page")
     log.debug("user was successfully logged out")
 def test_invalid_user_login(self):
     username = "******"
     password = "******"
     home = HomePage(self.driver)
     wait = WaitUtil(self.driver)
     action = ActionUtil(self.driver)
     log = self.getlogger()
     log.info("verify login with invalid user")
     wait.waitforVisibilityofElement(home.loginLink)
     home.getLoginLink().click()
     wait.waitforVisibilityofElement(home.loginPopUp)
     log.debug("login window opened")
     log.info("Loging in as user " + username)
     home.getUernameTextBox().clear()
     home.getUernameTextBox().send_keys(username)
     log.debug("Entered user name " + username)
     home.getPasswordTextBox().clear()
     home.getPasswordTextBox().send_keys(password)
     log.debug("entered password " + password)
     home.getLoginButton().click()
     alert = action.getAlert()
     alertText = alert.text
     log.debug("alert opened with text: " + alertText)
     assert alertText == "User does not exist.", "the alert text does not match expected"
     log.debug("the alert text matches expected")
     alert.accept()
     log.debug("alert accepted")
     home.getCloseLoginWindow().click()
     log.debug("login window was closed")
 def test_cancel_login(self, getLoginData):
     home = HomePage(self.driver)
     wait = WaitUtil(self.driver)
     log = self.getlogger()
     log.info("verify login")
     wait.waitforVisibilityofElement(home.loginLink)
     home.getLoginLink().click()
     wait.waitforVisibilityofElement(home.loginPopUp)
     log.debug("login window opened")
     username = getLoginData.get("TestData", "email")
     password = getLoginData.get("TestData", "password")
     log.info("Loging in as user " + username)
     home.getUernameTextBox().clear()
     home.getUernameTextBox().send_keys(username)
     log.debug("Entered user name " + username)
     home.getPasswordTextBox().clear()
     home.getPasswordTextBox().send_keys(password)
     log.debug("entered password " + password)
     home.getCloseLoginWindow().click()
     log.debug("login window was closed")
     wait.waitforVisibilityofElement(home.loginLink)
     assert not home.getUernameTextBox().is_displayed(
     ), "user was logged in"
     log.debug("username is not visible in home page")
     log.debug("user was successfully  able to cancel login window")
Esempio n. 13
0
    def test_e2e(self):
        log = self.getLogger()
        home_page = HomePage(self.driver)
        shop_page = home_page.shopItems()
        action = ActionChains(self.driver)
        action.move_to_element(shop_page.blackberry()).click().perform()
        self.driver.execute_script("window.scrollTo(document.body.scrollHeight,0);")

        if shop_page.menu_button().is_displayed():
            shop_page.menu_button().click()
            checkout_page = shop_page.checkout()
        else:
            checkout_page = shop_page.checkout()
        confirm_page = checkout_page.checkout_action()

        confirm_page.country_selector().send_keys('ukr')
        self.wait_until_object_located("CLASS_NAME", "suggestions")
        # <a xpath="1">Ukraine</a>
        confirm_page.choose_country().click()
        confirm_page.mark_checkbox().click()
        confirm_page.choose_purchase_button().click()
        success_test = confirm_page.get_alert_text().text
        log.info("success_test: " + success_test)
        assert "Success! Thank you!" in success_test, f"Incorrect message: {success_test}.Exected:'Success! Thank you!'"
        self.driver.get_screenshot_as_file("screen.png")
 def test_e2e(self):
     try:
         log = self.get_logger()
         log.info("*****Testcase 1 :Compare Mobile Testcase*****")
         homePage = HomePage(self.driver)
         homePage.click_compare().click()
         comparisionpage = homePage.click_mobile_compare()
         log.debug("Successfully clicked on compare")
         log.debug("User is nevigated to Comparision Page")
         name_to_search = self.read_from_excel("test1")
         log.debug(
             f"Successfully read the mobile name to search from Excel ::{name_to_search['Mobile_name'][0]}"
         )
         comparisionpage.click_add_mobile(name_to_search['Mobile_name'][0])
         log.debug("Successfully get the mobile name to search from Excel")
         log.debug("User is able to see comparision of selected mobiles")
         dict_of_items = comparisionpage.get_battery_info()
         log.info(dict_of_items)
         log.debug(
             "Successfully get the mobile name and battery rating into dictionary"
         )
         self.write_to_excel(dict_of_items, "test1")
         log.debug(
             "Successfully written data into Excel file from dictionary")
         log.info("*****END : Testcase 1*****\n")
         status = True
     except:
         log.info("Exception in Testcase 1 ")
 def test_deleteManualList(self):
     log = self.getLogger()
     homeobj = HomePage(self.driver)
     time.sleep(2)
     homeobj.clickHome()
     viewmanuallistproducts = ViewManualListProduct(self.driver)
     viewmanuallistproducts.clickOnMyWishList()
     viewmanuallistproducts.viewManualList()
     time.sleep(2)
     deletemanuallist = DeleteManualList(self.driver)
     deletemanuallist.clickOnDeleteSingleManuallist()
     deletemanuallist.clickOnPopupOk()
     listnotemptymsg = deletemanuallist.getErrorMsg()
     log.info(listnotemptymsg)
     deletemanuallist.closePopMsg()
     if listnotemptymsg == "List is not empty. Please move or delete the products":
         deletemanuallist.viewManualList()
         time.sleep(1)
         print(deletemanuallist.getProductName())
         deletemanuallist.deleteProductFromList()
         TestOne.test_popupmsg(self)
         time.sleep(1)
         deletemanuallist.backToManualList()
         time.sleep(1)
         deletemanuallist.clickOnDeleteSingleManuallist()
         deletemanuallist.clickOnPopupOk()
         time.sleep(1)
         log.info("List deleted successfully")
     else:
         deletemanuallist.clickOnDeleteSingleManuallist()
         deletemanuallist.clickOnPopupOk()
         log.info("List deleted successfully")
 def add(driver, contactName, contactEmail, isStar, contactPhone,
         contactComment):
     try:
         # 创建主页实例对象
         hp = HomePage(driver)
         # 点击通讯录连接
         hp.addressLink().click()
         time.sleep(3)
         # 创建添加联系人实例对象
         apd = AddressBookPage(driver)
         apd.createContactPersonButton().click()
         if contactName:
             # 非必填项
             apd.contactPersonName().send_keys(contactName)
             # 非必填项
             apd.contactPersonEmail().send_keys(contactEmail)
             if isStar == u"是":
                 # 非必填项
                 apd.starContacts().click()
             if contactPhone:
                 # 非必填项
                 apd.contactPersonMobile().send_keys(contactPhone)
             if contactComment:
                 apd.contactPersonComment().send_keys(contactComment)
             apd.saveContacePerson().click()
     except Exception as e:
         print(traceback.print_exc())
         raise e
Esempio n. 17
0
 def do_login(self, username, password):
     global row
     try:
         self.clearAndType(self.user_name, username)
         self.clearAndType(self.pwd, password)
         self.click(self.login_button)
         print('************************', self.driver.title)
         self.presenceOfElement(self.filter)
         # ExcelUtil.write_data(PropertyFile.getValues('excelFilePath'),
         #                      PropertyFile.getValues('logintd'), row, 6,
         #                      "successful")
         # ExcelUtil.write_data(PropertyFile.getValues('excelFilePath'),
         #                      PropertyFile.getValues('logintd'), row, 7,
         #                      'Pass')
         # row = row + 3
         ScreenShot.takeScreenshot(self.driver, 'successfully_logged_in')
         return HomePage(self.driver)
     except:
         value = self.getText(self.error_msg)
         print('%%%%%%%%%%%%%%%%%%%%%', self.driver.title)
         # ExcelUtil.write_data(PropertyFile.getValues('excelFilePath'),
         #                      PropertyFile.getValues('logintd'), row, 6,
         #                      "unsuccessful")
         # ExcelUtil.write_data(PropertyFile.getValues('excelFilePath'),
         #                      PropertyFile.getValues('logintd'), row, 7,
         #                      'Pass')
         # row = row + 3
         return None
Esempio n. 18
0
    def test_e2e(self):
        log = self.getLogger()
        homepage = HomePage(self.driver)
        log.info("Application started")
        homepage.shopItems().click()
        log.info("Shops Page started")

        checkout = CheckoutPage(self.driver)
        cards = checkout.cardTitles()
        log.info("Cards Selected")
        log.info(len(cards))
        i = -1
        for card in cards:
            i = i + 1
            cardText = card.text
            if cardText == "Blackberry":
                checkout.addProduct()[i].click()
        checkout.checkOut().click()

        confirmPage = ConfirmPage(self.driver)
        confirmPage.CartPage()
        confirmPage.CountrySelect().send_keys("ind")
        self.verifyLinkPresence("India", 7)
        self.driver.find_element_by_link_text("India").click()
        confirmPage.CheckBoxTerms()
        confirmPage.submitButton()
        successText = self.driver.find_element_by_class_name(
            "alert-success").text

        assert "Success! Thank you!" in successText
Esempio n. 19
0
    def test_formSubmission(self, getData):
        homepage = HomePage(self.driver)

        homepage.getName().send_keys(getData["firstName"])

        # time.sleep(5)

        # self.driver.find_element_by_name("name").send_keys("ritesh")

        homepage.getEmail().send_keys(getData["lastName"])

        homepage.getPassword().send_keys("dceeevwgmail.com")

        homepage.getCheckBox().click()

        select = Select(homepage.getGender())

        select.select_by_visible_text(getData["gender"])

        homepage.getStatus().click()

        homepage.getSubmit().click()

        time.sleep(5)

        self.driver.refresh()
    def test_endToEnd(self):
        log = self.getLogger()
        home_page = HomePage(self.driver)
        shop_page = home_page.shop_link()
        product_names = shop_page.getCardTitles()
        log.info("Getting product names..")

        i = -1
        for product_name in product_names:
            i = i + 1
            if product_name.text == "Blackberry":
                shop_page.getFooterButtons()[i].click()
                log.info("Product 'Blackberry' selected")
                break

        confirm_checkout_page = shop_page.getCheckoutButton()
        confirm_purchase_page = confirm_checkout_page.getConfirmCheckoutButton(
        )
        confirm_purchase_page.getCountryTextbox().send_keys("Ind")
        log.info("Entered the text as 'Ind'")
        self.verifyLinkPresence("India")
        confirm_checkbox = confirm_purchase_page.getConfirmCheckbox()
        self.driver.execute_script("arguments[0].click();", confirm_checkbox)
        confirm_purchase_page.getPurchaseButton().click()
        log.info("User confirmed the purchase")
        assert "Thank you" in confirm_purchase_page.getSuccessAlert().text
        log.info("Successfully purchased")
        self.driver.get_screenshot_as_file("endToEnd.png")
Esempio n. 21
0
    def test_e2e(self):
        log = self.getLogger()
        homePage = HomePage(self.driver)
        homePage.shopItems()
        log.info("getting all the card titles")
        checkoutPage = CheckoutPage(self.driver)
        cards = checkoutPage.getCardTitles()
        cardName = checkoutPage.getCardName()
        cardButton = checkoutPage.getCardButton()

        for card in cards:
            productName = card.text
            log.info(productName)
            if productName == "Blackberry":
                cardButton.click()

        self.driver.find_element_by_css_selector(
            "a[class*='btn-primary']").click()
        self.driver.find_element_by_xpath(
            "//button[@class='btn btn-success']").click()
        log.info("Entering country name as ind")
        self.driver.find_element_by_id("country").send_keys("ind")
        self.verifyLinkPresence("India")
        self.driver.find_element_by_link_text("India").click()
        self.driver.find_element_by_xpath(
            "//div[@class='checkbox checkbox-primary']").click()
        self.driver.find_element_by_css_selector(
            "input[type='submit']").click()
        success = self.driver.find_element_by_class_name("alert-success").text
        log.info("Text received from application is" + success)
        assert "Success! Thank you!" in success

        self.driver.get_screenshot_as_file("screen.png")
Esempio n. 22
0
    def test_e2e(self):
        log = self.getLogger()
        homePage = HomePage(self.driver)
        checkoutPage = homePage.shopItems()
        log.info("Getting all the card titles")
        # self.driver.find_element_by_css_selector("a[href*='shop']").click()
        # checkoutPage = CheckoutPage(self.driver)
        # products = checkoutPage.getCardTitles()
        # products = self.driver.find_elements_by_css_selector("div.card")
        cards = checkoutPage.getCardTitles()
        i = -1
        for card in cards:
            i = i + 1
            cardText = card.text
            log.info(cardText)
            if cardText == "Blackberry":
                checkoutPage.getCardFooter()[i].click()

        self.driver.find_element_by_css_selector(".btn-primary").click()
        # self.driver.find_element_by_xpath("//button[@class='btn btn-success']").click()
        confirmPage = checkoutPage.checkOutItems()
        log.info("Entering country name Ind")
        self.driver.find_element_by_id("country").send_keys("Ind")
        self.verifyLinkPresence("India")
        self.driver.find_element_by_link_text("India").click()
        self.driver.find_element_by_xpath(
            "//div[@class='checkbox checkbox-primary']").click()
        self.driver.find_element_by_css_selector(".btn-success").click()
        message = self.driver.find_element_by_class_name("alert-success").text
        log.info("Text received from application is " + message)
        assert "Success" in message
        self.driver.get_screenshot_as_file("D://ss.png")
Esempio n. 23
0
    def test_signin(self, getData):
        log = self.getLogger()
        log.info("Sign in form:")
        homepage = HomePage(self.driver)
        userName = getData["username"]
        log.info("UserName: "******"username"])
        homepage.signin_button().click()
        log.info("Clicking on sing in button...")

        self.verifyLinkPresenceByName("loginusername")

        email = homepage.getUsername().send_keys(getData["email"])
        log.info("Email: " + getData["email"])

        password = homepage.getPassword().send_keys(getData["password"])
        log.info("Password: "******"password"])

        signinButton = homepage.getLoginButton().click()

        self.verifyLinkPresenceByText(userName)

        signinName = str(homepage.getSigninName().text)
        signinName = signinName.replace("היי,", "")
        log.info("Singed in Username: " +signinName)

        assert signinName in userName
Esempio n. 24
0
    def test_e2e(self):
        homepage = HomePage(self.driver)

        checkOutPage = homepage.shopItems()
        #self.driver.find_element_by_css_selector("a[href*='shop']").click()
        cards = checkOutPage.getCardTitles()

        products = self.driver.find_elements_by_xpath("//div[@class='card h-100']")
        for product in products:
            productname = product.find_element_by_xpath("div/h4/a").text
            if productname == "Blackberry":
                product.find_element_by_xpath("div/button").click()
                break
        self.driver.find_element_by_css_selector("a[class*='btn-primary']").click()
        #self.driver.find_element_by_xpath("//button[@class='btn btn-success']").click()
        confirmpage = checkOutPage.CheckOutItem()
        self.driver.find_element_by_id("country").send_keys("ind")
        self.verifyLink("India")
        self.driver.find_element_by_link_text("India").click()
        self.driver.find_element_by_xpath("//div[@class='checkbox checkbox-primary']").click()
        self.driver.find_element_by_css_selector("input[type='submit']").click()
        msg = self.driver.find_element_by_class_name("alert-success").text

        assert "Success! Thank" in msg

        self.driver.get_screenshot_as_file("screen.png")
Esempio n. 25
0
    def test_9_keyPresses(self):
        # Home page menu - Key Presses
        homePage = HomePage(self.driver)
        homePage.keyPresses().click()

        # Press "ESC" key
        self.driver.find_element_by_id("target").send_keys(Keys.ESCAPE)
        time.sleep(2)
        # wait until 2 seconds
        self.driver.find_element_by_id("target").clear()
        time.sleep(2)
        # wait until 2 seconds

        # Press "Space" key
        self.driver.find_element_by_id("target").send_keys(Keys.SPACE)
        time.sleep(2)
        # wait until 2 seconds
        self.driver.find_element_by_id("target").clear()
        time.sleep(2)
        # wait until 2 seconds

        #Press "Back_Space" key
        self.driver.find_element_by_id("target").send_keys(Keys.BACK_SPACE)
        time.sleep(2)
        # wait until 2 seconds
        self.driver.find_element_by_id("target").clear()
        time.sleep(2)
Esempio n. 26
0
 def test_e2e(self):
     try:
         log = self.getLogger()
         time.sleep(5)
         homePage = HomePage(self.driver)
         homePage.getPermission1().click()
         homePage.getPermission2().click()
         homePage.getPermission1().click()
         homePage.getUsername().send_keys("DUSER146")
         log.info("Entered UserName 'DUSER146' Successfully")
         homePage.getPassword().send_keys("Tata@0909")
         log.info("Entered Password Successfully")
         homePage.getLoginSubmitButton().click()
         time.sleep(3)
         Epin = 0
         while Epin < 8:
             homePage.getEnterPin().click()
             Epin += 1
             time.sleep(0.5)
         time.sleep(2)
         homePage.getVersionUpdate().click()
         log.info("Login Successfully by using DSM credentials")
     except Exception as e:
         log.error(e)
         self.Screenshots()
    def test_formSubmission(self, getData):
        log = self.getLogger()
        homepage = HomePage(self.driver)

        log.info("Name is " + getData["name"])

        #homePage.getName().send_keys(getData[0]) TUPLE DATA TYPE
        homepage.getName().send_keys(getData["name"]) #DICTIONARY DATA TYPE


        #homePage.getEmail().send_keys(getData[1]) TUPLE DATA TYPE
        log.info("Email is " + getData["email"])
        homepage.getEmail().send_keys(getData["email"]) #DICTIONARY DATA TYPE

        #self.selectOptionByText(homePage.getGender(), getData[2]) TUPLE DATA TYPE
        log.info("Gender is " + getData["gender"])
        self.selectOptionByText(homepage.getGender(), getData["gender"]) #DICTIONARY DATA TYPE
        # as dropdown code can be used in multiple tests so
        # make it generic and place the code in base class, the attributes of it are locator and text

        homepage.submitForm().click()

        alertText = homepage.getSuccessMessage().text

        assert "Success!" in alertText

        self.driver.refresh()   # we are using refresh here because the url belongs to class and will execute only
    def test_addProductToList(self):
        homeobj = HomePage(self.driver)
        homeobj.clickHome()
        # search product (TestOne.test_searchProduct(self)
        log = self.getLogger()
        search = SearchPage(self.driver)
        keyword = search.searchKeyword
        search.enterSearchProduct().send_keys(keyword)
        search.clickSearchButton().click()
        self.driver.refresh()
        time.sleep(2)
        # Add product to list
        addproductlistobj = AddProductList(self.driver)
        productgrid = addproductlistobj.getProductsGrid()
        print(len(productgrid))
        addtolistbutton = addproductlistobj.getAddToListButton()
        print(len(addtolistbutton))
        for product in productgrid:
            product.click()
            time.sleep(1)
            for add in addtolistbutton:
                add.click()
                time.sleep(1)

        TestOne.test_popupmsg(self)
        homeobj.clickHome()
        self.driver.refresh()
Esempio n. 29
0
 def add(d, contract_name, contract_mobile, contract_memo):
     try:
         # 创建主页实例对象
         hp = HomePage(d=d)
         # 单击通讯录按钮
         hp.addresslink().click()
         time.sleep(5)
         # 创建添加联系人实例对象
         apb = AddressBookPage(d=d)
         apb.create_contractperson_btn().click()
         apb.switch_to_frame()
         time.sleep(1)
         # 必填项
         apb.contract_person_name().send_keys(contract_name)
         # 必填项
         apb.contract_person_mobile().send_keys(contract_mobile)
         if contract_memo:
             # 非必填项
             apb.contract_person_email().send_keys(contract_memo)
         # 单击添加联系人页面确定按钮
         apb.save_contract_person().click()
     except Exception as e:
         # 打印堆栈异常信息
         print(traceback.print_exc())
         raise e
Esempio n. 30
0
    def test_e2e(self):
        log = self.getLogger()
        homePage = HomePage(self.driver)
        checkOutPage = homePage.shopItems()
        log.info("getting all the card titles")
        cards = checkOutPage.getCardTitles()
        i = -1
        for card in cards:
            i = i+1
            cardText = card.text
            log.info(cardText)
            if cardText == 'Blackberry':
                checkOutPage.getCardFooter()[i].click()

        confirmPage = checkOutPage.clickOnPrimaryButton()
        confirmPage.clickSuccessButton().click()
        log.info("Entering country name India")
        confirmPage.sendCountryName().send_keys("ind")
        self.verifyLinkPresnce("India")
        confirmPage.selectCountryName().click()
        confirmPage.selectCheckboxOption().click()
        confirmPage.finalSubmitButton().click()
        successText = confirmPage.successPaymentText().text
        log.info("Text received from application is "+successText)
        assert 'Success' in successText