From e3136e56e08c5761669a6857244f8af59bcf4450 Mon Sep 17 00:00:00 2001 From: "Alex Xu (Hello71)" Date: Thu, 18 Jun 2020 10:56:02 -0400 Subject: disable image loading --- wfs.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wfs.py b/wfs.py index 7df6e90..48c033b 100755 --- a/wfs.py +++ b/wfs.py @@ -100,11 +100,16 @@ def start_wworker(driver_name): if driver_name == 'chrome': chrome_options = webdriver.chrome.options.Options() chrome_options.headless = True + chrome_options.experimental_options["prefs"] = { + "profile.default_content_setting_values.images": 2 + } DRIVER = webdriver.Chrome(options=chrome_options, desired_capabilities={'detach': True}) elif driver_name == 'firefox': + firefox_profile = webdriver.FirefoxProfile() + firefox_profile.set_preference('permissions.default.image', 2) firefox_options = webdriver.firefox.options.Options() firefox_options.headless = True - DRIVER = webdriver.Firefox(options=firefox_options) + DRIVER = webdriver.Firefox(firefox_profile=firefox_profile, options=firefox_options) else: raise Exception('unknown driver name') Finalize(DRIVER, stop_driver, exitpriority=16) -- cgit v1.2.3-70-g09d2