Пример #1
0
def test_enter_password():
    driver = InitiateDriver.startBrowser()
    driver.find_element_by_name(
        ConfigReader.fetchElementLocators('Registration',
                                          'password')).send_keys('abc')
    time.sleep(3)
    InitiateDriver.closeBrowser()
def test_ValidateRegistration(data):
    driver = InitiateDriver.startBrowser()
    Register = RegistrationPage.Registration(driver)
    Register.enter_Username(data[0])
    Register.enter_email(data[1])
    Register.enter_Dob(data[2])
    InitiateDriver.closeBrowser()
Пример #3
0
def test_third():
    driver = InitiateDriver.startBrowser()
    driver.maximize_window()

    print("page title is  :: " + driver.title)
    print("*******************************************")
    print("page URl is :: " + driver.current_url)

    print("*******************************************")
    print(driver.page_source)
    InitiateDriver.closeBrowser()
Пример #4
0
def test_222():
    '''driver = webdriver.Chrome(executable_path='C:/pychWork/Practise/driver/chromedriver.exe')
    import time
    driver.get("https://www.thetestingworld.com/testings/")'''

    driver = InitiateDriver.startBrowser()
    driver.maximize_window()
    print("Text on link is  :: " +driver.find_element_by_class_name("displayPopup").text)

    print("value of :: "+driver.find_element_by_xpath("//input[@type='submit']").get_attribute("type"))
    InitiateDriver.closeBrowser()
Пример #5
0
def test_fourth():
    driver = InitiateDriver.startBrowser()
    driver.maximize_window()

    #driver.find_element_by_xpath("//input[@name='fld_username']").send_keys("Hello")

    time.sleep(5)
    act = ActionChains(driver)
    #act.click(driver.find_element_by_xpath("//input[@name='fld_username']")).perform()
    act.context_click(
        driver.find_element_by_xpath(
            "//input[@name='fld_username']").send_keys("abc")).perform()
    InitiateDriver.closeBrowser()
Пример #6
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()
Пример #7
0
def test_validate_registration(data):
    driver = InitiateDriver.startBrowser()
    register = RegisterPage.Register(driver)
    register.enter_username(data[0])
    register.enter_pass(data[1])
    time.sleep(1)
    driver.close()
Пример #8
0
def test_validate_registration():
    driver = InitiateDriver.startBrowser()
    register = RegisterPage.Register(driver)
    register.enter_username('Sachin')
    register.enter_pass("tendulkar")
    time.sleep(3)
    driver.close()
Пример #9
0
def test_search_valid_data(data):
    driver = InitiateDriver.start_browser()
    search = SearchPage.SearchPage(driver)
    driver.find_element_by_xpath(ConfigReader.read_elements('Search', 'search_icon')).click()
    search.enter_key(data[0])
    driver.find_element_by_xpath(ConfigReader.read_elements('Search', 'search_button')).click()
    driver.close()
Пример #10
0
def test_data():
    driver = InitiateDriver.StartBrowser()

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

    # driver = InitiateDriver.CloseBrowser()
Пример #11
0
def login(data):
    global driver1
    driver1 = InitiateDriver.startBrowser()
    log = loginPage.loginPageClass(driver1)
    log.loginLink()
    log.emailId(data[0])
    log.password(data[1])
    log.loginBut()
def loginWebsite(data):
    driver1 = InitiateDriver.startBrowser()
    login = loginPage.loginPageClass(driver1)
    login.loginLink()
    login.emailId(data[0])
    login.password(data[1])
    login.loginBut()
    driver1.close()
def addItemsToCart():
    driver1 = InitiateDriver.startBrowser()
    driver1.execute_script("window.scrollTo(0, 200);")
    shopcart = addtoshoppincartPage.addToCartClass(driver1)
    shopcart.bookLink()
    shopcart.additems()
    driver1.execute_script("window.scrollTo(0, 0);")
    shopcart.moveToCart()
    driver1.close()
Пример #14
0
def test_sixth():
    driver = InitiateDriver.startBrowser()
    driver.maximize_window()

    driver.find_element_by_xpath("//input[@name='fld_username']").send_keys(
        "Hello")

    act = ActionChains(driver)
    # act.send_keys(Keys.TAB).perform()
    #act.key_down(Keys.CONTROL).send_keys('a').perform()
    act.key_down(Keys.CONTROL).send_keys('a').key_down(
        Keys.CONTROL).send_keys('c').perform()
    time.sleep(5)
    driver.find_element_by_xpath(
        "//input[contains(@placeholder,'*****@*****.**')]").send_keys(
            "scenario 5")
    #act.send_keys(Keys.CONTROL).key_down(Keys.ALT).send_keys(Keys.DELETE).perform()
    #time.sleep(10)
    InitiateDriver.closeBrowser()
Пример #15
0
def test_ValidRegistration():
    driver = InitiateDriver.startBroswer()
    #driver.find_element_by_name(ConfigReader.fetchElementLocators('Registration','username_name')).send_keys("hello")
    #driver.find_element_by_name(ConfigReader.fetchElementLocators('Registration','email_name')).send_keys("abc")
    register = RegistrationPage.RegistrationClass(driver)
    register.enter_username('hello')
    #register.enter_email('abc')
    #driver.implicitly_wait(15)
    register.enter_email(data[0])
    register.enter_password(data[1])
Пример #16
0
def ValidateRegistration(data):
    driver1 = InitiateDriver.startBrowser()
    register = registrationPage.registrationPageClass(driver1)
    register.registerLink()
    register.enterGender()
    register.enterFirstName(data[0])
    register.lastName(data[1])
    register.emailId(data[2])
    register.password(data[3])
    register.confirmPass(data[4])
    register.registerButton()
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)
Пример #18
0
def test_one_way_flight_booking(data):
    driver = InitiateDriver.start_browser()
    flights = flight_booking.FlightBooking(driver)
    flights.book_one_way_ticket(data[0], data[1])

    InitiateDriver.close_browser()
def test_LoginInvalidation():
    driver = InitiateDriver.startBrowser()
    login = LoginPage.LoginClass(driver)
    login.enter_email("*****@*****.**")
    driver.close()
def test_registration_invalid_data():
    driver = InitiateDriver.startBroswer()
    register = RegistrationPage.RegistrationClass(driver)
    register.enter_password('password')
    driver.implicitly_wait(15)
    driver.close()
Пример #21
0
def test_Login():
    driver = InitiateDriver.startBrowser()
    #Logging in
    login = Login_Page.LoginClass(driver)
    login.enter_email('*****@*****.**')
    login.enter_password('PyTestPass')
    login.click_login_button()

    #Navigating Left Hand Nav
    nav = Navigation.NavigationClass(driver)
    time.sleep(3)
    nav.click_Home()
    nav.click_Calendar()
    nav.click_Contacts()
    nav.click_Companies()
    nav.click_Deals()
    nav.click_Tasks()
    nav.click_Cases()
    nav.click_Calls()
    nav.click_Documents()
    nav.click_Email()
    nav.click_Campaigns()
    nav.click_Forms()

    #Creating Form
    form = Create_Form.Create_Form_Class(driver)
    form.click_New_button()
    form.enter_name('Mr. PyTest')
    form.enter_intro_text('Nice to meet you!')
    form.enter_completion_text('See you next time!')
    form.click_Save_button()
    time.sleep(3)
    #form.click_Submit_button()

    # Logging out
    login = Login_Page.LoginClass(driver)
    login.click_settings_button()
    time.sleep(3)
    login.click_logout_button()


#  def test_Navigation():
#      driver = InitiateDriver.startBrowser()
#     nav = Navigation.NavigationClass(driver)
#     time.sleep(5)
#     nav.click_Home()
#     nav.click_Calendar()
#     nav.click_Companies()
#     nav.click_Deals()

# def test_Valid_login():
#     driver = InitiateDriver.startBrowser()
#     driver.find_element_by_name(Config_Reader.fetchElementLocators("Login","email_name")).send_keys("*****@*****.**")
#     driver.find_element_by_name(Config_Reader.fetchElementLocators("Login","password_name")).send_keys("PyTestPass")
#     driver.find_element_by_xpath("//div[contains(text(),'Login')]").click()
#     time.sleep(3)
#     assert driver.title == "Cogmento CRM"
#     driver.close()

# @pytest.fixture(scope="module")
# def env_test_setup():
# global driver
# path = "/Users/Naveed/Downloads/chromedriver"
# driver = Chrome(executable_path=path)
# driver.get("https://ui. cogmento.com/")
# driver.maximize_window()
#
# def test_valid_login_credentials():
#     driver.find_element_by_name("email").send_keys("*****@*****.**")
#     driver.find_element_by_name("password").send_keys("PyTestPass")
#     driver.find_element_by_xpath("//div[contains(text(),'Login')]").click()
#     time.sleep(3)
#     assert driver.title == "Cogmento CRM"
#
# def test_invalid_login_credentials():
#     driver.find_element_by_name("email").send_keys("*****@*****.**")
#     driver.find_element_by_name("password").send_keys("FakePass")
#     driver.find_element_by_xpath("//div[contains(text(),'Login')]").click()
#     assert driver.find_element_by_name("email").is_displayed()
#
# time.sleep(5)
Пример #22
0
def test_ValidateRegistration():
    print("inside validate method")
    drv = InitiateDriver.startBrowser()
    print(drv)
    reg = RegistrationPage.registrationclass(drv)
    reg.enter_kwsearch()
Пример #23
0
def test_ValidataRegistration():
    driver = InitiateDriver.startBrowser()
    driver.find_element_by_name('fld_username').send_keys('hellow')
    driver.close()
def test_booking_bus():
    driver = InitiateDriver.start_browser()
    hotel = bus_booking.BusBooking(driver)
    hotel.book_bus("Mysore", "ooty")

    InitiateDriver.close_browser()
Пример #25
0
def test_Registration_Invalid_data():
    driver = InitiateDriver.startBrowser()

    driver.close()
Пример #26
0
def test_LoginValidation(data):
    driver = InitiateDriver.startBrowser()
    login = LoginPage.LoginClass(driver)
    login.enter_username(data[0])
    login.enter_password(data[1])
    driver.close()
def test_validate_reg():
    driver = InitiateDriver.Start_browser()
    driver.maximize_window()
    driver.get("http://thetestingworld.com/testings")
    driver.close()
def test_TC002():
    print("inside TC002 method")
    InitiateDriver.closeBrowser()
Пример #29
0
def test_runsuite(self):
    driver = InitiateDriver.teststartBrowser()
    nau = Main_Page.enter_creadential(self)
def test_ValidateRegistration(data):
    driver = InitiateDriver.startBrowser()
    register = RegistrationPage.RegistrationClass(driver)
    register.enter_username(data[0])
    register.enter_password(data[1])
    driver.close()