def setUp(self): self.logger = Log() self.verificationErrors = [] self.logger.info( '############################### START ###############################' ) browser = ReadConfig().read_config(conf_path, "BROWSER", "browser") self.dr = Browser(browser).driver() self.dr.maximize_window()
class MyTest(unittest.TestCase): """ The base class is for all testcase. """ @classmethod def setUpClass(self): self.logger = Log() self.verificationErrors = [] self.logger.info( '############################### START ###############################' ) browser = ReadConfig().read_config(conf_path, "BROWSER", "browser") self.dr = Browser(browser).driver() self.dr.maximize_window() @classmethod def tearDownClass(self): self.dr.close() self.dr.quit() self.logger.info( '############################### End ###############################' )
#coding=utf-8 from selenium import webdriver from Common.public.log import Log from Common.public.readconfig import ReadConfig logger = Log() class Browser: def __init__(self, browser): self.browser = browser def driver(self): if self.browser == "firefox" or self.browser == "ff": logger.info("正在启动Firefox浏览器") driver = webdriver.Firefox() elif self.browser == "chrome" or self.browser == "Chrome": logger.info("正在启动Chrome浏览器") driver = webdriver.Chrome() elif self.browser == "internet explorer" or self.browser == "ie": logger.info("正在启动IE浏览器") driver = webdriver.Ie() elif self.browser == "opera": logger.info("正在启动opera浏览器") driver = webdriver.Opera() elif self.browser == "edge":
def __init__(self): self.log = Log()