Commit 23c9299c by 宋鹏博

1

parent 0d2263e8
...@@ -14,14 +14,14 @@ class DriverTools: ...@@ -14,14 +14,14 @@ class DriverTools:
@classmethod @classmethod
def get_driver(cls): def get_driver(cls):
if cls.__driver is None: if cls.__driver is None:
cls.__options = webdriver.ChromeOptions() cls.__options = Options()
cls.__options.add_argument('--headless') cls.__options.add_argument('--headless')
cls.__options.add_argument('--disable-gpu') cls.__options.add_argument('--disable-gpu')
cls.__options.add_argument('--no-sandbox') cls.__options.add_argument('--no-sandbox')
cls.__options.add_argument('--disable-dev-shm-usage') cls.__options.add_argument('--disable-dev-shm-usage')
cls.__options.add_argument('--remote-debugging-port=9222') cls.__options.add_argument('--remote-debugging-port=9222')
cls.__options.add_argument('--window-size=1366x768') cls.__options.add_argument('--window-size=1366x768')
cls.__driver = webdriver.Chrome(chrome_options=cls.__options) cls.__driver = webdriver.Chrome(options=cls.__options)
# cls.__driver.maximize_window() # cls.__driver.maximize_window()
cls.__driver.implicitly_wait(10) cls.__driver.implicitly_wait(10)
return cls.__driver return cls.__driver
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment