Java设计模式之单例设计模式实战代码【多测师】
from selenium import webdriver from _elementtree import Element from selenium.common.exceptions import NoSuchElementException class DriverManagment(object): driver = None @staticmethod def getDriver(self): if DriverManagment.driver = None: if get_conf_browser() == "Chrome": DriverManagment.driver = webdriver.Firefox() else if: ... return DriverManagment.driver def closeDriver(self): driver.close() DriverManagment.driver = None; driver = DriverManagment.getDriver()