def test_bei_diao_1(self): '''从工作台成功进入输入三要素页面''' loginpage = LoginPage(self.driver, self.url, u'登录-知了背调') loginpage.user_password_login('17717564981', '1234qwer') faqipage = FaQiBeiDiaoPage(self.driver, self.url, u'登录-知了背调') faqipage.click_start_reference_check() self.assertEqual(faqipage.get_fa_qi_bei_diao_text(), '填写信息')
def test_Login(self): # 获取excel数据 data = self.getData() loginPage = LoginPage(self.driver, self.url, u"login") loginPage.open() for i in data: self.doLogin(loginPage,i)
def test_login(self): #初始化loginpage loginPage = LoginPage(self.driver) #判断是否需要登录(如果已登录就不需要登录) needLogin = loginPage.needLogin() if needLogin: self.codeLogin(loginPage)
def test_login_error(self, cases, open_browser): driver = open_browser url = eval(conf.get('url', 'url')) driver.get(url) l_page = LoginPage(driver) l_page.login(cases['mobile'], cases['pwd']) actual = l_page.get_error_text() assert cases['expected'] in actual
def stu_login_fixture(): driver = create_driver(is_headers=True) driver.maximize_window() driver.implicitly_wait(15) url = eval(conf.get('url', 'url')) driver.get(url) login=LoginPage(driver) mobile=conf.get('test_data', 'mobile_stu') pwd = conf.get('test_data', 'pwd_stu') login.login(mobile,pwd) yield driver driver.quit()
def test_login_pass(self, cases, open_browser): expect = cases['expected'] driver = open_browser url = eval(conf.get('url', 'url')) driver.get(url) login_page = LoginPage(driver) login_page.login(cases['mobile'], cases['pwd']) index_page = IndexPage(driver) res = index_page.is_login_success() try: assert res == expect except AssertionError as e: log.error('【登录成功的用例】————>执行失败') log.exception(e) raise e else: log.info('【登录成功的用例】————>执行通过')
class TestLogin(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.url = LoginPage.url self.driver.maximize_window() self.page = LoginPage(self.driver) self.page.get(self.url) def tearDown(self): self.driver.close() def test_login(self): self.page.input_name = username self.page.input_pw = password self.page.login_btn.click() time.sleep(2) #断言 self.assertEqual(self.page.content_assert,self.driver.current_url,msg='登陆失败')
def setUp(self): self.driver = webdriver.Firefox() self.url = LoginPage.url self.driver.maximize_window() self.page = RecordPage(self.driver) self.login = LoginPage(self.driver) self.page.get(self.url) #登陆 self.login.input_name = username self.login.input_pw = password self.login.login_btn.click() time.sleep(2) # 档案 self.page.record.click() time.sleep(2)
def setUp(self): self.firefox_options = Options() self.firefox_options.add_argument('--headless') self.driver = webdriver.Firefox() self.url = LoginPage.url self.driver.maximize_window() self.page = PersonalCenterPage(self.driver) self.login = LoginPage(self.driver) self.page.get(self.url) #登陆 self.login.input_name = username self.login.input_pw = password self.login.login_btn.click() time.sleep(2) # 鼠标悬停头像上 move = self.driver.find_element_by_xpath(self.page.center) ActionChains(self.driver).move_to_element(move).perform() time.sleep(2) # 点击个人中心 self.page.personalcenter.click() time.sleep(2)
def login_page(self): return LoginPage(self.driver)
def test_Login_1(self): page = LoginPage(self.driver) page.open('https://pc.shaxiaoseng.com:4433/User/login.html') print(page.get_title()) account = '13521137793' passwd = '1111112' page.input_account(account) page.input_passwd(passwd) page.click_LoginSubmit('沙小僧-取金路上 小沙为您保驾护航')
def setUp(self): self.driver = webdriver.Firefox() self.url = LoginPage.url self.driver.maximize_window() self.page = LoginPage(self.driver) self.page.get(self.url)
def page_get_LoginPage(self): return LoginPage(self.driver)
def goLogin(self): loginPage = LoginPage(self.driver, self.url, u"login") loginPage.open() loginPage.input_userName(CommonVar.USERNAME) loginPage.input_passWord(CommonVar.PASSWORD) loginPage.input_imageCode(CommonVar.IMAGECODE) loginPage.login()
# 使用row_click()方法是为了直接选择要编辑的数据 TableOperation(self.driver).row_click(header_text, row_text) self.edit_button_element().click() self.edit_dialog(code, name, sex, grader, button) def delete_data(self, header_text, row_text, button="确定"): """编辑数据""" # 使用row_click()方法是为了直接选择要删除的数据 TableOperation(self.driver).row_click(header_text, row_text) self.delete_button_element().click() if button == "确定": self.del_confirm_button_element().click() elif button == "取消": self.del_cancel_button_element().click() else: print("编辑弹窗中的按钮只能确定和取消") if __name__ == '__main__': from selenium import webdriver from base.get_driver import GetDriver driver = GetDriver.get_driver() a = LoginPage(driver) a.login() home = HomePage(driver) home.add_data("1001", "张三") home.search("张三") home.edit_data("姓 名", "张三", name="李四") home.search("李四") home.delete_data("姓 名", "李四")
def get_login(cls): """返回登录页""" return LoginPage()
def test_02(self): try: driver = self.driver po = LoginPage(driver) po.start() po.log_home() po.log_user("qupan") po.log_pass("qp66666") po.log_click() time.sleep(3) po.end() except Exception as e: po.end() po.error(e) raise
def setUpClass(cls): cls.driver = webdriver.Chrome() cls.login = LoginPage(cls.driver)
def setUpClass(cls): # (self):#Class(cls): cls.driver = GetDriver.get_driver() cls.calc = LoginPage(cls.driver) cls.calc.login()
def test_login(self): loginpage = LoginPage(self.driver) loginpage.login()