class BaseTestCase(unittest.TestCase): def setUp(self): self.browser=Browser() self.driver=self.browser.open_browser() # self.driver=webdriver.Chrome("../tools/chromedriver.exe") # self.driver.maximize_window() # self.driver.implicitly_wait(5) def tearDown(self): self.driver=self.browser.quit_browser()
def setup_class(self): c = Config() self.config = c.prepare() browser_conf = self.config["browser"] self.browser = Browser(browser_conf, self.config) self._screenshot_number = 1 self.verification_errors = [] self.driver = self.browser.driver self.assertions = Assertions(self.driver, self.verification_errors)
def setUpClass(cls): """ 初始化操作 打开浏览器 1、实例化一个浏览器对象 browser 1、先创建一个浏览器的类 Browser,已在frameword文件夹创建该类 2、导入该类,使用from framework.browser import Browser导入,注意 3、实例化对象 browser = Browser(cls) 2、调用browser打开浏览器,并赋值给cls.driver使其成为该测试类的属性: cls.driver = browser.open_browser(cls) """ cls.browser = Browser(cls) cls.driver = cls.browser.open_browser(cls) cls.taobaohomepage = TaobaoHomePage(cls.driver)
def setUpClass(cls): cls.browser = Browser(cls) cls.driver = cls.browser.open_browser(cls) cls.taobaohomepage = TaoBaoHomePage(cls.driver)
def setUp(self): self.browser=Browser() self.driver=self.browser.open_browser()
def print_keys(): for key in cf.__dict__.keys(): print(cf.__dict__.get(key).keys()) if 'grid' in cf.__dict__.get(key).items(): print('grid in cf') if 'screenshots' in cf['sframe']: if cf['sframe']['screenshots']: print("has screenshots option") default_browser = cf["browser"] print(default_browser) browser = Browser(default_browser, cf) driver = browser.driver verification_errors = [] assertions = Assertions(driver, verification_errors) print('browser is dict') print(dir(browser)) if hasattr(browser, 'config'): print('has attr config') if hasattr(browser, 'proxy'): print('browser hasattr proxy') proxy = browser.proxy print('closing proxy') proxy.close()