diff options
author | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2020-06-18 10:56:02 -0400 |
---|---|---|
committer | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2020-06-18 10:56:02 -0400 |
commit | e3136e56e08c5761669a6857244f8af59bcf4450 (patch) | |
tree | b0c33dc3dac04e132be0ab0fe3641fbb31aa8cd4 | |
parent | e5812eeba105d16a76afa4a4aeaa51e3b35e377c (diff) | |
download | wfs-e3136e56e08c5761669a6857244f8af59bcf4450.tar.xz wfs-e3136e56e08c5761669a6857244f8af59bcf4450.zip |
disable image loading
-rwxr-xr-x | wfs.py | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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) |