def setUp(self): self.driver = webdriver.Firefox() self.driver.get(properties._url) self.login_page = LoginPage(self.driver) self.login_page.login(properties.user, properties.password) self.login_page.click_submit()
def test_login_system(self): # login_page = LoginPage(self.driver) login_page = LoginPage(self.driver) login_page.set_username("35771") login_page.set_password("9876501") login_page.set_vcode("2024") login_page.click_login("signin")
def test_login(self): username = '******' psw = '123456' url = "http://39.107.96.138:3000/" #向类中传入需要的三个参数 lg = LoginPage(self.driver, username, psw, url) lg.login() # result_username = lg.get_login_name() # self.assertEqual(result_username, username) c_url = lg.is_url_success() # print(url) self.assertEqual(c_url, url)
class Add_Remove_Test(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.driver.get(properties._url) self.login_page = LoginPage(self.driver) self.login_page.login(properties.user, properties.password) self.login_page.click_submit() #def test_login(self): #self.login_page def test_delete_new_record(self): self.login_page add_new_lnk = PageNavi(self.driver) add_new_lnk.add_lnk() #click on add new link page_add_new = AddNew(self.driver) # filling Address on second page on Add new page page_add_new.fill_address( random_test_data.random_letters(5)) and self.assertTrue( random_test_data.random_letters(5)) # fill the address field page_add_new.click_next # navigate to next page # Filling user data page_add_new.fill_user_name(properties.f_name, properties.m_name, properties.l_name) self.assertTrue(properties.f_name) and self.assertTrue( properties.m_name) and self.assertTrue(properties.l_name) page_add_new.set_email(properties.e_mail) and self.assertTrue( properties.e_mail) page_add_new.set_phone('+' + properties.phone_number) and self.assertTrue( '+' + properties.phone_number) page_add_new.click_enter() self.driver.implicitly_wait(10) # Search on the main page main_page = MainPage(self.driver) main_page.search_element(properties.phone_number) and self.assertTrue( properties.phone_number) #self.driver.implicitly_wait(10) main_page.select_all_element() main_page.delete_bttn() main_page.accept_alert() def tearDown(self): self.driver.quit()
class BaseTest(unittest.TestCase): """ Base Test Class used for login to the openattic web UI. """ def setUp(self): self.loginpage = LoginPage(self.driver) self.loginpage.login() def tearDown(self): print(self._testMethodDoc) try: self.loginpage.logout() except: print('ERROR: Not possible to logout due to some error.')
class Add_Remove_Test(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.driver.get(properties._url) self.login_page = LoginPage(self.driver) self.login_page.login(properties.user, properties.password) self.login_page.click_submit() #def test_login(self): #self.login_page def test_delete_new_record(self): self.login_page add_new_lnk = PageNavi(self.driver) add_new_lnk.add_lnk() #click on add new link page_add_new = AddNew(self.driver) # filling Address on second page on Add new page page_add_new.fill_address(random_test_data.random_letters(5)) and self.assertTrue(random_test_data.random_letters(5)) # fill the address field page_add_new.click_next # navigate to next page # Filling user data page_add_new.fill_user_name(properties.f_name, properties.m_name, properties.l_name) self.assertTrue(properties.f_name) and self.assertTrue(properties.m_name) and self.assertTrue(properties.l_name) page_add_new.set_email(properties.e_mail) and self.assertTrue(properties.e_mail) page_add_new.set_phone('+' + properties.phone_number) and self.assertTrue('+' + properties.phone_number) page_add_new.click_enter() self.driver.implicitly_wait(10) # Search on the main page main_page = MainPage(self.driver) main_page.search_element(properties.phone_number) and self.assertTrue(properties.phone_number) #self.driver.implicitly_wait(10) main_page.select_all_element() main_page.delete_bttn() main_page.accept_alert() def tearDown(self): self.driver.quit()
def test_log_in_experticava25(self): """ Test login experticava25. Ingresa a la plataforma con las credenciales especificas :param self: """ # Log in login_page = LoginPage(self.driver) login_page.click_posgrado_button() login_page.username_element = 'exper-tic' # login_page.password_element = 'exper-tic' login_page.password_element = 'exper-tic' login_page.click_login_button()
class NavigationTest(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.driver.get(properties._url) self.login_page = LoginPage(self.driver) self.login_page.login(properties.user, properties.password) self.login_page.click_submit() #def test_login(self): #self.login_page #login_page = LoginPage(self.driver) #login_page.login(user, password) #login_page.click_submit() def test_navigation(self): self.login_page page_navi = PageNavi(self.driver) page_navi.navigation() def tearDown(self): self.driver.quit()
class TestClass(unittest.TestCase): driver = webdriver.Chrome() login_page = LoginPage(driver) @classmethod def setUpClass(cls): cls.driver.maximize_window() cls.driver.get(LoginPage.import_config("URL")) cls.driver.implicitly_wait(5) def test_method_valid_login(self): self.login_page.valid_login() self.assertEqual(LoginPage.import_config("title"), self.login_page.get_page_title()) @classmethod def tearDownClass(cls): cls.driver.quit()
class TestLogin(object): locators_login = CDPLocators() pageFn = LoginPage() @pytest.mark.mobile1 def test_app_launch(self): driver = self.pageFn.launchapp() #wait = WebDriverWait(driver, 10) elem=WebDriverWait(driver,5).until( ec.visibility_of_element_located((By.XPATH,self.locators_login.LOC_ENVIRONMENT_QA))) elem.click() #driver.implicitly_wait(10) elem2=WebDriverWait(driver,30).until(ec.visibility_of_element_located((By.ID,"com.reviverauto.rplate:id/txtSignIn"))) elem2.click() driver.find_element_by_id("com.reviverauto.rplate:id/txtSignIn").click() #driver.find_element_by_xpath(self.locators_login.LOC_SIGNIN).click() # elem2 = WebDriverWait(driver, 5).until( # ec.visibility_of_element_located((By.XPATH,))) # elem2.click WebDriverWait(driver, 5).until( ec.visibility_of_element_located((By.XPATH, self.locators_login.LOC_SIGNIN_BUTTON))) driver.find_element_by_xpath(self.locators_login.LOC_EMAIL_TEXTBOX).send_keys(testdata.username) driver.find_element_by_xpath(self.locators_login.LOC_PASSWORD_TEXTBOX).click().send_keys(testdata.password) driver.find_element_by_xpath(self.locators_login.LOC_EMAIL_TEXTBOX).click() asselem=driver.find_element_by_xpath(self.locators_login.LOC_HOMEPAGE_TOOLBAR) if(asselem.is_displayed()): print("HOMEPAGE IS DISPLAYED") else: print("TESTING FAILED") time.sleep(5) driver.quit()
def test_method_valid_login(self): self.login_page.valid_login() self.assertEqual(LoginPage.import_config("title"), self.login_page.get_page_title())
def setUpClass(cls): super().setUp(cls) cls.login = LoginPage(cls.driver) cls.login.login() cls.page = cls.login
def setUp(self): super().setUp() self.login = LoginPage(self.driver)
class TestLogin(TestHRMBase): """ TBD """ def setUp(self): super().setUp() self.login = LoginPage(self.driver) def test_TC_L_001(self): self.login.assert_elem_text(LoginPageLocators.LOGIN_PANEL, 'LOGIN Panel') user_name_input = self.login.driver.find_element(*LoginPageLocators.USERNAME) self.assertEqual(user_name_input.tag_name, 'input') password_input = self.login.driver.find_element(*LoginPageLocators.PASSWORD) self.assertEqual(password_input.tag_name, 'input') self.login.is_clickable(LoginPageLocators.LOGIN_BUTTON) def test_TC_L_002(self): self.login.send_text(LoginPageLocators.USERNAME, self.login.default_username) self.login.send_text(LoginPageLocators.PASSWORD, self.login.default_password) self.login.click(LoginPageLocators.LOGIN_BUTTON) self.assertTrue('dashboard' in self.login.driver.current_url) self.assertTrue('<h1>Dashboard</h1>' in self.login.driver.page_source) def test_TC_L_003(self): self.login.send_text(LoginPageLocators.USERNAME, self.login.default_username) self.login.send_text(LoginPageLocators.PASSWORD, 'password') self.login.click(LoginPageLocators.LOGIN_BUTTON) self.login.assert_elem_text(LoginPageLocators.SPAN_MSG, 'Invalid credentials')
def test_login_page(self): login_page = LoginPage(self.driver) login_page.login(user, password) login_page.click_submit()
for course in SCHEDULE: course_code = course['code'] times = course['time'] for time in times: if time['day'] == current_day and time[ 'begin'] <= current_hour <= time['end']: if "password" in time: password = time['password'] else: password = None driver = webdriver.Chrome("chromedriver_linux64/chromedriver") driver.get( "https://casv.um.edu.my/cas/loginAllType?service=https%3A%2F%2Fspectrum.um.edu.my%2Flogin%2Findex.php" ) loginPage = LoginPage(driver) loginPage.login(USERNAME, PASSWORD) while True: try: profilePage = ProfilePage(driver) profilePage.select_course(course_code) coursePage = CoursePage(driver) coursePage.enter_status_page() statusPage = StatusPage(driver) if statusPage.attendance_signed() != -1: statusPage.enter_attendance_page() attendancePage = AttendancePage(driver) if password is not None: attendancePage.sign_attendance(password=password) else: attendancePage.sign_attendance()
def setUp(self): self.loginpage = LoginPage(self.driver) self.loginpage.login()
def test_case(self, browser): page = LoginPage(browser) page.username.send_keys(TestData.admin) page.passowrd.send_keys(TestData.admin_pawd) # ... page.close()
def login(driver, page_url): login_page = LoginPage(driver, 'https://www.coursera.org/?authMode=login') login_page.fill_up_email('*****@*****.**') login_page.fill_up_password('yourpassword') login_page.click_login() return
def test_case(self): page = LoginPage(self.browser) page.username.send_keys(TestData.user) page.passowrd.send_keys(TestData.pawd)
def setUpClass(cls): cls.driver.maximize_window() cls.driver.get(LoginPage.import_config("URL")) cls.driver.implicitly_wait(5)