通过传 不同参数 来测试不同的浏览器,做浏览器兼容性测试
import os
from selenium import webdriver
class Base:
def setup(self):
def setup(self):
browser = os.getenv("browser")
if browser == 'firefox':
self.driver = webdriver.Firefox()
elif browser == 'headless':
self.driver = webdriver.PhantomJS()
else:
self.driver = webdriver.Chrome()
self.driver.implicitly_wait(3)
self.driver.maximize_window()
def teardown(self):
self.driver.quit()