Last active
September 21, 2018 22:32
-
-
Save jesus-sayar/af3ab06bee6859d25366bf954ee783d6 to your computer and use it in GitHub Desktop.
Selenium + BrowserMob Proxy configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.bmp_server = Server(‘/Users/dummy/browsermob_proxy_binary’) | |
self.bmp_server.start() | |
self.web_proxy = self.bmp_server.create_proxy() | |
self.web_proxy.new_har(“web_har_data”, options={‘captureHeaders’: True}) | |
profile = webdriver.FirefoxProfile() | |
profile.set_preference(“network.proxy.type”, 1) | |
profile.set_preference(“network.proxy.http”, “localhost”) | |
profile.set_preference(“network.proxy.http_port”, self.web_proxy.port) | |
profile.set_preference(“network.proxy.ssl”, “localhost”) | |
profile.set_preference(“network.proxy.ssl_port”, self.web_proxy.port) | |
profile.assume_untrusted_cert_issuer = True | |
profile.accept_untrusted_certs = True | |
profile.set_preference("browser.cache.disk.enable", False) | |
profile.set_preference("browser.cache.memory.enable", False) | |
profile.set_preference("network.http.use-cache", False) | |
self.web_driver = webdriver.Firefox(firefox_profile=profile, capabilities=DesiredCapabilities.FIREFOX.copy()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment