コード例 #1
0
    def deleteAddressDetails(self):
        log = Logger.getlogger()
        try:
            deletebtn = self.driver.find_element(*AddressPage.obj_deletebtn)
            deletebtn.click()
            WaitUtilities.waitForAlertIsPresent(self.driver, 5)

            Alerts = self.driver.switch_to.alert
            Alerts.accept()
            WaitUtilities.waitForElementVisible(self.driver,
                                                AddressPage.obj_successmsg, 5)

            successmsg = self.driver.find_element(*AddressPage.obj_successmsg)

            actualmsg = successmsg.text

            if actualmsg == "Address was successfully destroyed.":
                Reporter.passed(
                    self.driver,
                    "Address should be successfully Deleted.::Address is successfully Deleted."
                )
                log.info("Address Details is Deleted successfully")
            else:
                assert False

        except AssertionError as e:
            Reporter.failed(
                self.driver,
                "Address should be Deleted.::Address is not Deleted.")
            log.info("Address Details is not deleted successfully")
        except Exception as e:
            log.error("Exception Occurred", exc_info=True)
コード例 #2
0
    def logoutfromapplication(self):
        log = Logger.getlogger()
        try:
            logoutbtn = self.driver.find_element(*HomePage.obj_signout)
            logoutbtn.click()

            flag = WaitUtilities.waitforpagetitleis(self.driver,
                                                    "Address Book - Sign In",
                                                    5)

            if flag:
                Reporter.passed(
                    self.driver,
                    "should be Logout from Application.::Successfully Logout from Application."
                )
                log.info("Successfully Logout from Application.")
            else:
                assert False

        except AssertionError as e:
            Reporter.failed(
                self.driver,
                "should be Logout from Application.::Failed to Logout from Application."
            )
            log.error("Failed to Logout from Application.")

        except Exception as e:
            log.error("Exception Occurred", exc_info=True)
コード例 #3
0
    def verifyautosuggestioncheckboxselect(self, name):
        log = Logger.getlogger()
        try:
            AutoSuggest = self.driver.find_element(*AutomationPracticePage.obj_dynamicinput)
            AutoSuggest.clear()
            AutoSuggest.send_keys(name)
            WaitUtilities.waitForElementVisible(self.driver, (By.XPATH, "//ul[contains(@class,'ui-menu')]/li/div[text()='"+name+"']"), 5)
            AutoSuggestValue = self.driver.find_element_by_xpath("//ul[contains(@class,'ui-menu')]/li/div[text()='"+name+"']")
            AutoSuggestValue.click()
            log.info("Value is Entered in Auto Suggestion Input Box")

            select = Select(self.driver.find_element(*AutomationPracticePage.obj_dropdown))

            AllOptions = select.options

            for i in AllOptions:
                log.info(i.text)

            select.select_by_value("option3")

            CheckBoxes = self.driver.find_elements(*AutomationPracticePage.obj_checkbox)

            for checkbox in CheckBoxes:
                checkbox.click()
                log.info(checkbox.text)

            if not False:
                Reporter.passed(self.driver, "CheckBox should be selected::CheckBox Button is Selected")
            else:
                assert False
        except AssertionError as e:
            Reporter.failed(self.driver, "CheckBox should be selected::CheckBox is not selected.")
        except Exception as e:
            log.error("Exception Occurred", exc_info=True)
コード例 #4
0
    def verifyalertshowhidetabledata(self):
        log = Logger.getlogger()
        try:
            AlertInputBox = self.driver.find_element(*AutomationPracticePage.obj_alertinputbox)

            AlertInputBox.clear()
            AlertInputBox.send_keys("Nagesh")

            AlertBtn = self.driver.find_element(*AutomationPracticePage.obj_alertbtn)

            AlertBtn.click()

            WaitUtilities.waitForAlertIsPresent(self.driver, 5)

            Alerts = self.driver.switch_to.alert

            log.info("Alert Text is "+Alerts.text+"")

            Alerts.accept()

            DisplayedElement = self.driver.find_element(*AutomationPracticePage.obj_dispelement)

            log.info("CSS Value "+DisplayedElement.value_of_css_property("font-size")+"")

            HideBtn = self.driver.find_element(*AutomationPracticePage.obj_hidebtn)

            HideBtn.click()

            log.info("Clicked on Hide Button")

            ShowBtn = self.driver.find_element(*AutomationPracticePage.obj_showbtn)

            ShowBtn.click()

            if DisplayedElement.is_displayed():
                Reporter.passed(self.driver, "InputBox should be Displayed when clicked on Show Button::InputBox is Displayed when clicked on Show Button")
            else:
                assert False

            log.info("Clicked on Show Button ")

            TableElement = self.driver.find_element(*AutomationPracticePage.obj_table)

            TableHeader = TableElement.find_elements_by_xpath("th")

            for i in TableHeader:
                log.info("Table header " + i.text)

            TableRow = self.driver.find_elements(*AutomationPracticePage.obj_tabledata)

            for j in TableRow:
                log.info("Table Row data " + j.text)
        except AssertionError as e:
            Reporter.failed(self.driver, "InputBox should be Displayed when clicked on Show Button:InputBox is not Displayed when clicked on Show Button.")
        except Exception as e:
            log.error("Exception Occurred", exc_info=True)
コード例 #5
0
ファイル: repo_check.py プロジェクト: Dasithp/BigDataAnalysis
def main():
    """
    Main driver.
    """

    args = parse_args()
    reporter = Reporter()
    repo_url = get_repo_url(args.source_dir, args.repo_url)
    check_labels(reporter, repo_url)
    reporter.report()
コード例 #6
0
def main():
    """
    Main driver.
    """

    args = parse_args()
    reporter = Reporter()
    repo_url = get_repo_url(args.repo_url)
    check_labels(reporter, repo_url)
    reporter.report()
コード例 #7
0
def main():
    """Main driver."""

    args = parse_args()
    args.reporter = Reporter()
    life_cycle = check_config(args.reporter, args.source_dir)
    # pre-alpha lessons should report without error
    if life_cycle == "pre-alpha":
        args.permissive = True
    check_source_rmd(args.reporter, args.source_dir, args.parser)

    args.references = {}
    if not using_remote_theme(args.source_dir):
        args.references = read_references(args.reporter, args.reference_path)

    docs = read_all_markdown(args.source_dir, args.parser)
    check_fileset(args.source_dir, args.reporter, list(docs.keys()))
    check_unwanted_files(args.source_dir, args.reporter)
    for filename in list(docs.keys()):
        checker = create_checker(args, filename, docs[filename])
        checker.check()

    args.reporter.report()
    if args.reporter.messages and not args.permissive:
        exit(1)
コード例 #8
0
    def verifywindoframewswitchtooltip(self):
        log = Logger.getlogger()
        sflag = False
        try:
            parentwindowhanlde = self.driver.current_window_handle
            openwindowbutton = self.driver.find_element(*AutomationPracticePage.obj_openwindow)
            self.driver.execute_script("arguments[0].click();", openwindowbutton)
            windowhandles = set(self.driver.window_handles)
            WaitUtilities.waitForWindowIsPresent(self.driver, 10)
            for windowhandle in windowhandles:
                self.driver.switch_to.window(windowhandle)
                if self.driver.title == "QA Click Academy | Selenium,Jmeter,SoapUI,Appium,Database testing,QA Training Academy":
                    log.info("Switched to Child Window")
                    sflag = True
                    self.driver.close()
                    break

            self.driver.switch_to.window(parentwindowhanlde)
            log.info("Switched back to Parent Window")

            Reporter.info("Should be Switched to Child Window::Switched to Child Window Successfully.")

            self.driver.switch_to.frame("courses-iframe")
            log.info("Switched to Frame Successfully")
            homelink = self.driver.find_element(*AutomationPracticePage.obj_homelinkbtn)

            self.driver.execute_script("arguments[0].scrollIntoView(false);", homelink)

            self.driver.switch_to.parent_frame()

            log.info("Switched to Parent Frame Successfully")

            action = ActionChains(self.driver)

            mousehoverelement = self.driver.find_element(*AutomationPracticePage.obj_mousehover)

            action.move_to_element(mousehoverelement).click_and_hold(mousehoverelement).perform()

            WaitUtilities.waitForElementVisible(self.driver, AutomationPracticePage.obj_tooltiptext, 5)
            tooltiptexts = self.driver.find_elements(*AutomationPracticePage.obj_tooltiptext)

            for tooltipelement in tooltiptexts:
                log.info("Tooltip Text " + tooltipelement.text)
        except AssertionError as e:
            Reporter.failed(self.driver, "Should be Switched to Child Window::Not Switched to Child Window.")
        except Exception as e:
            log.error("Exception Occurred", exc_info=True)
コード例 #9
0
    def logintoapplication(self):
        log = Logger.getlogger()
        try:

            credentials = ExcelUtils.readdata("Testdata.xlsx", "Credentials",
                                              2)

            userNames = ExcelUtils.getdata(credentials, "Username")
            passwords = ExcelUtils.getdata(credentials, "Password")

            WaitUtilities.waitforpagetitleis(self.driver,
                                             "Address Book - Sign In", 5)
            signinbtn = self.driver.find_element(*LoginPage.obj_signin)

            WaitUtilities.waitForElementVisible(self.driver,
                                                LoginPage.obj_signin, 5)
            signinbtn.click()
            username = self.driver.find_element(*LoginPage.obj_username)
            password = self.driver.find_element(*LoginPage.obj_password)
            loginbtn = self.driver.find_element(*LoginPage.obj_loginbtn)
            WaitUtilities.waitForElementVisible(self.driver,
                                                LoginPage.obj_username, 5)
            username.send_keys(userNames)
            password.send_keys(passwords)
            loginbtn.click()

            flag = WaitUtilities.waitforpagetitleis(self.driver,
                                                    "Address Book", 5)

            if flag:
                Reporter.passed(
                    self.driver,
                    "should be Login to Application.::Successfully Login to Application."
                )
                log.info("Successfully Login to Application.")
            else:
                assert False

        except AssertionError as e:
            Reporter.failed(
                self.driver,
                "should be Login to Application.::Failed to Login to Application."
            )
            log.error("Failed to Login to Application.")

        except Exception as e:
            log.error("Exception Occurred", exc_info=True)
コード例 #10
0
def main():
    '''Run as the main program.'''

    if len(sys.argv) != 2:
        print(USAGE, file=sys.stderr)
        sys.exit(1)

    root_dir = sys.argv[1]
    index_file = os.path.join(root_dir, 'index.html')
    config_file = os.path.join(root_dir, '_config.yml')

    reporter = Reporter()
    check_config(reporter, config_file)
    with open(index_file) as reader:
        data = reader.read()
        check_file(reporter, index_file, data)
    reporter.report()
コード例 #11
0
def main():
    '''Run as the main program.'''

    if len(sys.argv) != 2:
        print(USAGE, file=sys.stderr)
        sys.exit(1)

    root_dir = sys.argv[1]
    index_file = os.path.join(root_dir, 'index.html')
    config_file = os.path.join(root_dir, '_config.yml')

    reporter = Reporter()
    check_config(reporter, config_file)
    check_unwanted_files(root_dir, reporter)
    with open(index_file) as reader:
        data = reader.read()
        check_file(reporter, index_file, data)
    reporter.report()
コード例 #12
0
    def verifyAddressDetails(self):
        log = Logger.getlogger()
        try:
            addressbtn = self.driver.find_element(*AddressPage.obj_addressbtn)
            addressbtn.click()

            WaitUtilities.waitForElementVisible(self.driver,
                                                AddressPage.obj_newaddressbtn,
                                                5)

            tablerow = self.driver.find_element(*AddressPage.obj_tablerow)

            tabledata = tablerow.find_elements_by_xpath("td")

            fname = tabledata[0].text
            lname = tabledata[1].text
            city = tabledata[2].text
            state = tabledata[3].text

            MyDict = {
                "First Name": fname,
                "Last Name": lname,
                "City": city,
                "State": state
            }

            ExcelUtils.writedata("Testdata.xlsx", "Address", 3, MyDict)

            if fname == "Nagesh":
                Reporter.passed(
                    self.driver,
                    "Address Details should be verified successfully.::Address Details is verified successfully."
                )
                log.info("Address Details is verified successfully")
            else:
                assert False

        except AssertionError as e:
            Reporter.failed(
                self.driver,
                "Address should be verified.::Address is not verified.")
            log.error("Address Details is not verified successfully")
        except Exception as e:
            log.error("Exception Occurred", exc_info=True)
コード例 #13
0
    def verifymenuselection(self):
        log = Logger.getlogger()
        sflag = False
        try:
            WaitUtilities.waitforpagetitleis(
                self.driver,
                "Free QA Automation Tools Tutorial for Beginners with Examples",
                5)
            tutorial = self.driver.find_element(
                *MenuSelectionPage.obj_tutorial)
            backendtesting = self.driver.find_element(
                *MenuSelectionPage.obj_backendtesting)
            restassured = self.driver.find_element(
                *MenuSelectionPage.obj_restassured)

            action = ActionChains(self.driver)

            action.move_to_element(tutorial).perform()
            WaitUtilities.waitForElementVisible(
                self.driver, MenuSelectionPage.obj_backendtesting, 5)
            action.move_to_element(backendtesting).click_and_hold().perform()
            WaitUtilities.waitForElementVisible(
                self.driver, MenuSelectionPage.obj_restassured, 5)
            action.move_to_element(restassured).click().perform()
            sflag = WaitUtilities.waitforpagetitleis(
                self.driver,
                "Rest Assured Tutorial for REST API Automation Testing", 5)

            if sflag:
                Reporter.passed(
                    self.driver,
                    "RestAssured Menu should be selected::RestAssured Menu is selected."
                )
            else:
                assert False

        except AssertionError as e:
            Reporter.failed(
                self.driver,
                "RestAssured Menu should be selected::RestAssured Menu is not selected."
            )
        except Exception as e:
            log.error("Exception Occurred", exc_info=True)
コード例 #14
0
    def verifyradiobtnisselectedornot(self):
        log = Logger.getlogger()
        sflag = False
        try:
            RadioButtons = self.driver.find_elements(*AutomationPracticePage.obj_radiobtns)
            for radiobutton in RadioButtons:
                if radiobutton.get_attribute("value") == "radio2":
                    radiobutton.click()
                    log.info("Radio Button is Selected")
                    sflag = True
                    break

            if not sflag:
                Reporter.passed(self.driver, "Radiobutton should be selected::Radio Button is Selected")
            else:
                assert False
        except AssertionError as e:
            Reporter.failed(self.driver, "Radiobutton should be selected::Radiobutton is not selected.")
        except Exception as e:
            log.error("Exception Occurred", exc_info=True)
コード例 #15
0
def main():
    """Main driver."""

    args = parse_args()
    args.reporter = Reporter(args)
    check_config(args)
    docs = read_all_markdown(args, args.source_dir)
    check_fileset(args.source_dir, args.reporter, docs.keys())
    for filename in docs.keys():
        checker = create_checker(args, filename, docs[filename])
        checker.check()
    args.reporter.report()
コード例 #16
0
    def verifytooltiptext(self):
        log = Logger.getlogger()
        sflag = False
        try:
            WaitUtilities.waitforpagetitleis(
                self.driver,
                "Selenium Practise: How to automate tooltip in Selenium webdriver",
                5)
            hoverme = self.driver.find_element(*ToolTipTextPage.obj_hoverme)
            tooltiptext = self.driver.find_element(
                *ToolTipTextPage.obj_tooltiptext)

            action = ActionChains(self.driver)

            action.move_to_element(hoverme).click_and_hold().perform()

            WaitUtilities.waitForElementVisible(
                self.driver, ToolTipTextPage.obj_tooltiptext, 5)

            tooltipmsg = tooltiptext.text

            if tooltipmsg == "Tooltip text":
                Reporter.passed(
                    self.driver,
                    "ToolTip Text should be 'Tooltip text'.::ToolTip Text is 'Tooltip text'."
                )
            else:
                assert False

        except AssertionError as e:
            Reporter.failed(
                self.driver,
                "ToolTip Text should be 'Tooltip text'.::ToolTip Text is not 'Tooltip text'."
            )

        except Exception as e:
            log.error("Exception Occurred", exc_info=True)
コード例 #17
0
def main():
    """Main driver."""

    args = parse_args()
    args.reporter = Reporter()
    check_config(args.reporter, args.source_dir)
    args.references = read_references(args.reporter, args.reference_path)

    docs = read_all_markdown(args.source_dir, args.parser)
    check_fileset(args.source_dir, args.reporter, docs.keys())
    check_unwanted_files(args.source_dir, args.reporter)
    for filename in docs.keys():
        checker = create_checker(args, filename, docs[filename])
        checker.check()

    args.reporter.report()
コード例 #18
0
def main():
    """Main driver."""

    args = parse_args()
    args.reporter = Reporter()
    check_config(args.reporter, args.source_dir)
    check_source_rmd(args.reporter, args.source_dir, args.parser)
    args.references = read_references(args.reporter, args.reference_path)

    docs = read_all_markdown(args.source_dir, args.parser)
    check_fileset(args.source_dir, args.reporter, list(docs.keys()))
    check_unwanted_files(args.source_dir, args.reporter)
    for filename in list(docs.keys()):
        checker = create_checker(args, filename, docs[filename])
        checker.check()

    args.reporter.report()
    if args.reporter.messages and not args.permissive:
        exit(1)
コード例 #19
0
    def fillAddressDetails(self):
        log = Logger.getlogger()
        try:

            addressbtn = self.driver.find_element(*AddressPage.obj_addressbtn)
            addressbtn.click()

            WaitUtilities.waitForElementVisible(self.driver,
                                                AddressPage.obj_newaddressbtn,
                                                5)

            newaddressbtn = self.driver.find_element(
                *AddressPage.obj_newaddressbtn)

            newaddressbtn.click()

            WaitUtilities.waitForElementVisible(self.driver,
                                                AddressPage.obj_fname, 5)

            addressdata = ExcelUtils.readdata("Testdata.xlsx", "Address", 2)

            testdataholder = ExcelUtils.getdata(addressdata, "First Name")

            fname = self.driver.find_element(*AddressPage.obj_fname)

            fname.send_keys(testdataholder)

            testdataholder = ExcelUtils.getdata(addressdata, "Last Name")

            lname = self.driver.find_element(*AddressPage.obj_lname)

            lname.send_keys(testdataholder)

            testdataholder = ExcelUtils.getdata(addressdata, "Street")

            streetaddrs = self.driver.find_element(
                *AddressPage.obj_streetaddrs)

            streetaddrs.send_keys(testdataholder)

            testdataholder = ExcelUtils.getdata(addressdata,
                                                "Secondary Address")

            secondaddrs = self.driver.find_element(
                *AddressPage.obj_secondaddrs)

            secondaddrs.send_keys(testdataholder)

            testdataholder = ExcelUtils.getdata(addressdata, "City")

            city = self.driver.find_element(*AddressPage.obj_city)

            city.send_keys(testdataholder)

            testdataholder = ExcelUtils.getdata(addressdata, "State")

            state = Select(self.driver.find_element(*AddressPage.obj_state))

            state.select_by_value(testdataholder)

            testdataholder = ExcelUtils.getdata(addressdata, "ZipCode")

            zipcode = self.driver.find_element(*AddressPage.obj_zipcode)

            zipcode.send_keys(testdataholder)

            testdataholder = ExcelUtils.getdata(addressdata, "Country")

            country = self.driver.find_element(*AddressPage.obj_country)

            country.click()

            testdataholder = ExcelUtils.getdata(addressdata, "Age")

            age = self.driver.find_element(*AddressPage.obj_age)

            age.send_keys(testdataholder)

            testdataholder = ExcelUtils.getdata(addressdata, "Website")

            website = self.driver.find_element(*AddressPage.obj_website)

            website.send_keys(testdataholder)

            uploadbtn = self.driver.find_element(*AddressPage.obj_upload)

            action = ActionChains(self.driver)

            action.move_to_element(uploadbtn).click().perform()

            Utilities.uploadfile(
                "E:\\CodeWorkspace\\SeleniumWithPythonPractice\\SeleniumWithPythonGitHub\\resources\\testdata\\abc.txt"
            )

            testdataholder = ExcelUtils.getdata(addressdata, "Phone")

            phone = self.driver.find_element(*AddressPage.obj_phone)

            phone.send_keys(testdataholder)

            testdataholder = ExcelUtils.getdata(addressdata, "Interest")

            interest = self.driver.find_element(*AddressPage.obj_interest)

            interest.click()

            testdataholder = ExcelUtils.getdata(addressdata, "Note")

            note = self.driver.find_element(*AddressPage.obj_note)

            note.send_keys(testdataholder)

            submitbtn = self.driver.find_element(*AddressPage.obj_submitbtn)

            submitbtn.click()

            WaitUtilities.waitForElementVisible(self.driver,
                                                AddressPage.obj_successmsg, 5)

            successmsg = self.driver.find_element(*AddressPage.obj_successmsg)

            actualmsg = successmsg.text

            if actualmsg == "Address was successfully created.":
                Reporter.passed(
                    self.driver,
                    "Address should be successfully created.::Address is successfully created."
                )
                log.info("Address is successfully created.")
            else:
                assert False

        except AssertionError as e:
            Reporter.failed(
                self.driver,
                "Address should be successfully created.::Address is not successfully created."
            )
            log.error("Address is not successfully created.")
        except Exception as e:
            log.error("Exception Occurred", exc_info=True)