Example #1
0
 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()
Example #2
0
 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
Example #3
0
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()
Example #4
0
 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('【登录成功的用例】————>执行通过')
Example #5
0
        # 使用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("姓 名", "李四")
Example #6
0
 def test_login(self):
     loginpage = LoginPage(self.driver)
     loginpage.login()