def setup_class(self): # 1:获取driver driver = GetDriver.get_web_driver(page.url_mp) # 2:获取统一入口类获取类 self.mp = PageIn(driver).page_get_PageMpLogin() pass
def setup_class(cls): WinRM().run_bat_file() cls.driver = GetDriver.get_web_driver(page.URL) cls.cart = PageCart(cls.driver) cls.login = PageLogin(cls.driver) cls.login.page_login() cls.login.page_keep_return_FP()
def setup_class(cls): WinRM().run_bat_file() read_sql('tp_order.sql') read_sql('tp_order_goods.sql') print('初始化用户订单') cls.driver = GetDriver.get_web_driver(page.URL) cls.order = PageOrder(cls.driver) cls.login = PageLogin(cls.driver) cls.login.page_login() cls.login.page_keep_return_FP() cls.driver2 = GetDriver.get_web_driver2(page.URL2) cls.ms = PageOrder(cls.driver2) cls.order_number = None
def setup_class(self): # 1:获取driver driver = GetDriver.get_web_driver(page.url_mp) # 2:获取统一入口类获取类 self.page_in = PageIn(driver) # 获取PageMpLogin对象并调用登录成功依赖方法 self.page_in.page_get_PageMpLogin().page_mp_login_success("13812345678", 246810) # 获取PageMpLogin页面对象 self.article = self.page_in.page_get_PageMpArticle() pass
def setup_class(cls): WinRM().run_bat_file() cls.driver = GetDriver.get_web_driver(page.URL) cls.login = PageLogin(cls.driver)
self.__base_write_img(path, filename) # 私有方法,将截图添加到报告中 def __base_write_img(self, path, filename): log.info(f'正在将截图{filename}写入报告中') with open(path, 'rb') as f: log.info('打开文件') allure.attach(f.read(), f'这里是错误原因,截图名字:{filename}', allure.attachment_type.PNG) # 获取页面元素属性 def base_get_element_values(self, loc, value): log.info(f'获取元素{loc}属性{value}的值') return self.base_find_element(loc).get_attribute(value) # 判断元素是否可用 def base_if_el_is_enabled(self, loc): log.info(f"判断元素{loc}是否可用") if self.base_find_element(loc).is_enabled(): log.info('元素可用,返回True') return True else: log.info('元素不可用,返回False') return False if __name__ == '__main__': driver = GetDriver.get_web_driver(page.URL) b = Base(driver) b.base_get_screenshot('111')
def setUp(self) -> None: # 1.获取driver driver = GetDriver.get_web_driver(page.url_login) # 2.通过统一入口类获取LoginPage对象 self.login = PageIn(driver).page_get_LoginPage()
def setup_class(cls): WinRM().run_bat_file() cls.driver = GetDriver.get_web_driver(page.URL) cls.register = PageRegister(cls.driver) read_sql('tp_users.sql')