def tearDown(self): if(self.defaultTestResult().failures): fileName = Formatter().format("{0}{1}.jpg", "f:\\",time.time().__str__()) self.basePage.browser.get_screenshot_as_file(fileName) self.basePage.browser.close_App() browserManage= BrowserManage() self.browser = browserManage.clearBrowser()
def tearDown(self): if (self.defaultTestResult().failures): fileName = Formatter().format("{0}{1}.jpg", "f:\\", time.time().__str__()) self.basePage.browser.get_screenshot_as_file(fileName) self.basePage.browser.close_App() browserManage = BrowserManage() self.browser = browserManage.clearBrowser()
def before_scenario(context, scenario): env_tag = context.config.userdata['env'] browser_tag=context.config.userdata['browser'] # if you want to debug just uncomment below line and comment above line #env_tag = 'qa' #browser_tag='chrome' if env_tag == 'qa': AccountManage() else: AccountManage('staging') context.browserManager = BrowserManage() if browser_tag=='appium': browser_setting = BrowserType.APPIUM context.browserManager.add_browser_queue( Browser(browser_setting, command_executor='http://127.0.0.1:4723/wd/hub', desired_capabilities={ 'platformName': 'iOS', 'platformVersion': '11.2', 'deviceName': 'iPad Air', 'browserName': "Safari" })) else: browser_setting = BrowserType.CHROME context.browserManager.add_browser_queue(Browser(browser_type=browser_setting)) context.browser = context.browserManager.get_browser() #context.browser.maximize_window() context.browser.open(AccountManage.url) _init_page(context)
def __init__(self,plateform='Android'): browserManage= BrowserManage() self.browser = browserManage.setBrowser(plateform)
def __init__(self,plateform=None): browserManage= BrowserManage() self.browser = browserManage.setBrowser(plateform)