summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2020-06-18 10:56:02 -0400
committerAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2020-06-18 10:56:02 -0400
commite3136e56e08c5761669a6857244f8af59bcf4450 (patch)
treeb0c33dc3dac04e132be0ab0fe3641fbb31aa8cd4
parente5812eeba105d16a76afa4a4aeaa51e3b35e377c (diff)
downloadwfs-e3136e56e08c5761669a6857244f8af59bcf4450.tar.xz
wfs-e3136e56e08c5761669a6857244f8af59bcf4450.zip
disable image loading
-rwxr-xr-xwfs.py7
1 files changed, 6 insertions, 1 deletions
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)