def setUp(self) -> None: lp = BroswerModel() self.driver = lp.broswer_chrome() DK = BasePage(driver=self.driver) DK.open() DL = LoginPage(driver=self.driver) username, password = data_Dl_ex()[0] DL.login(username, password) print("开始测试")
def setUp(self) -> None: print('写信测试') liulan = BroswerModel() # 实例化一个浏览器类 self.driver = liulan.broswer_chrome() # driver重命名 BP = BasePage(driver=self.driver) # 引入一个driver BP.open() DL = LoginPage(driver=self.driver) username, password = data_Dl_ex()[1] DL.login(username, password)
def get_cookie(self): bp = BasePage(self.driver) lp = LoginPage(self.driver) bp.open(LOGIN_URL) self.send_keys(self.username_locator, self.username) self.send_keys(self.password_locator, self.password) self.click(self.login_button_locator) data = self.driver.get_cookies()[0] data = str(data) f = open('./cookie', "w") f.write(data) f.close()
def setUp(self): '''打开登录页面''' lp = BroswerModel() self.driver = lp.broswer_chrome() dk = BasePage(driver=self.driver) dk.open()