Пример #1
0
def test_data():
    driver = InitiateDriver.StartBrowser()

    reg = RegistrationData.RegisterData(driver)
    reg.PasswordName("QWER")
    reg.CpasswordName("QWER")

    # driver = InitiateDriver.CloseBrowser()
Пример #2
0
def testValidateRegistration():
    #we need to import InitiateDriverFile to call Start Broser Function Import path start from project level
    from Base import InitiateDriver
    #Base is not a package it is folder and to treat as a package we need to create a test.py file in Base folder
    #calling StartBrowser it will return object for driver and storing in driver
    driver = InitiateDriver.StartBrowser()
    #inserting value in user Name
    #Xpath is read from register config file
    # driver.find_element_by_xpath("//input[@placeholder='myusername']").send_keys("HelloWorld")
    driver.find_element_by_xpath(
        ReadConfigFile.RegistrationPageData(
            'Registration', 'MyUserName')).send_keys("HelloWorld")
    #Calling Close Browser
    InitiateDriver.CloseBrowser()
def test_MultiWindow():
    from Base import InitiateDriver
    driver = InitiateDriver.StartBrowser()
    #above code helps to comment out below code
    # from selenium.webdriver import Chrome
    # path = 'D:\\Python\\chromedriver.exe'
    # driver = Chrome(executable_path=path)
    # driver.get("https://thetestingworld.com/testings/")
    # driver.maximize_window()
    # in below code properties of object is given in config file and it is read with help ReadConfigFile
    driver.find_element_by_xpath(ReadConfigFile.LoginPageData(
        'Login', 'login')).click()
    driver.find_element_by_name(
        ReadConfigFile.LoginPageData('Login', 'UserName')).send_keys('test')
    driver.find_element_by_name(
        ReadConfigFile.LoginPageData('Login', 'Password')).send_keys('test')
    driver.find_element_by_xpath(
        ReadConfigFile.LoginPageData('Login', 'LoginBtn')).click()
    driver.find_element_by_xpath(
        ReadConfigFile.MyAccountData('Account', 'myaccount')).click()
    driver.find_element_by_xpath(
        ReadConfigFile.MyAccountData('Account', 'delete')).click()
    # for tab also we use window handels a it returns number of tab open in driver
    alltabs = driver.window_handles
    mainwindow = ''
    print(alltabs)
    for win in alltabs:
        driver.switch_to.window(win)
        # using above code we are switching to windows and to identify in which tab we need to perform action we are using current URL with IF
        # we can use driver.title or any other element present on page if URL and Title are Dynamic
        print(driver.current_url)
        if (driver.current_url ==
                "https://thetestingworld.com/testings/manage_customer.php"):
            driver.find_element_by_xpath(
                "//button[text()='Start Download']").click()
            mainwindow = win
        # else:
        #    driver.close()
        # need to move back to main window as controle is on Las window
    driver.switch_to.window(mainwindow)
Пример #4
0
def test_ABC(data):
    driver = InitiateDriver.StartBrowser()
    objRegistration= Registration.registration(driver)
    objRegistration.username(data[0])
    objRegistration.email(data[1])
Пример #5
0
def test_data(data):
    driver = InitiateDriver.StartBrowser()
    reg = RegistrationData.RegisterData(driver)
    reg.UsernameName(data[0])
    reg.EmailName(data[1])
Пример #6
0
def test_pomregistration():
    driver = InitiateDriver.StartBrowser()
    objRegistration = Registration.registration(driver)
    objRegistration.username('romesh')
    objRegistration.email('*****@*****.**')