Commit 4ad8574b authored by Barkin Simsek's avatar Barkin Simsek 🐢
Browse files

Refactor Firefox based fetchers

parent dcaeb006
...@@ -32,10 +32,11 @@ class FirefoxBrowser(BaseFetcher): ...@@ -32,10 +32,11 @@ class FirefoxBrowser(BaseFetcher):
ff_profile = FirefoxProfile() ff_profile = FirefoxProfile()
# Install the extensions # Install the extensions
self._install_har_export_extension(ff_profile.extensionsDir) self._install_har_export_extension_xpi(ff_profile.extensionsDir)
# Enable the network monitoring tools to record HAR in Firefox Browser # Enable the network monitoring tools to record HAR in Firefox Browser
ff_profile.set_preference("devtools.netmonitor.enabled", True) ff_profile.set_preference("devtools.netmonitor.enabled", True)
ff_profile.set_preference("devtools.toolbox.selectedTool", "netmonitor")
ff_profile.set_preference("devtools.netmonitor.har.compress", False) ff_profile.set_preference("devtools.netmonitor.har.compress", False)
ff_profile.set_preference( ff_profile.set_preference(
"devtools.netmonitor.har.includeResponseBodies", False "devtools.netmonitor.har.includeResponseBodies", False
...@@ -60,7 +61,7 @@ class FirefoxBrowser(BaseFetcher): ...@@ -60,7 +61,7 @@ class FirefoxBrowser(BaseFetcher):
ff_profile.set_preference("network.proxy.socks_remote_dns", True) ff_profile.set_preference("network.proxy.socks_remote_dns", True)
# Set selenium related options for Firefox Browser # Set selenium related options for Firefox Browser
self._desired_capabilities = webdriver.DesiredCapabilities.FIREFOX self._desired_capabilities = webdriver.DesiredCapabilities.FIREFOX.copy()
self._selenium_options = webdriver.FirefoxOptions() self._selenium_options = webdriver.FirefoxOptions()
self._selenium_options.profile = ff_profile self._selenium_options.profile = ff_profile
self._selenium_options.add_argument("--devtools") self._selenium_options.add_argument("--devtools")
......
...@@ -55,10 +55,11 @@ class TorBrowser(BaseFetcher): ...@@ -55,10 +55,11 @@ class TorBrowser(BaseFetcher):
tb_profile = FirefoxProfile(profile_location) tb_profile = FirefoxProfile(profile_location)
# Install the extensions # Install the extensions
self._install_har_export_extension(tb_profile.extensionsDir) self._install_har_export_extension_xpi(tb_profile.extensionsDir)
# Enable the network monitoring tools to record HAR in Tor Browser # Enable the network monitoring tools to record HAR in Tor Browser
tb_profile.set_preference("devtools.netmonitor.enabled", True) tb_profile.set_preference("devtools.netmonitor.enabled", True)
tb_profile.set_preference("devtools.toolbox.selectedTool", "netmonitor")
tb_profile.set_preference("devtools.netmonitor.har.compress", False) tb_profile.set_preference("devtools.netmonitor.har.compress", False)
tb_profile.set_preference( tb_profile.set_preference(
"devtools.netmonitor.har.includeResponseBodies", False "devtools.netmonitor.har.includeResponseBodies", False
...@@ -95,7 +96,7 @@ class TorBrowser(BaseFetcher): ...@@ -95,7 +96,7 @@ class TorBrowser(BaseFetcher):
tb_profile.set_preference("extensions.torbutton.versioncheck_enabled", False) tb_profile.set_preference("extensions.torbutton.versioncheck_enabled", False)
# Set selenium related options for Tor Browser # Set selenium related options for Tor Browser
self._desired_capabilities = webdriver.DesiredCapabilities.FIREFOX self._desired_capabilities = webdriver.DesiredCapabilities.FIREFOX.copy()
self._selenium_options = webdriver.FirefoxOptions() self._selenium_options = webdriver.FirefoxOptions()
self._selenium_options.profile = tb_profile self._selenium_options.profile = tb_profile
self._selenium_options.add_argument("--devtools") self._selenium_options.add_argument("--devtools")
......
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