Python- Using Proxy(Browsermob) with Remote Webdriver -


i'm trying check on network traffic on site using browsermob proxy. running following: i've found proxy server refusing connections:

"the proxy server refusing connections" "firefox configured use proxy refusing connections."

i have yet find example in python setting proxy remote webdriver.

    server = server("location/browsermob-proxy-2.0-beta-9/bin/browsermob-proxy")     server.start()     proxy = server.create_proxy()      selenium import webdriver     profile  = webdriver.firefoxprofile()     profile.set_proxy(proxy.selenium_proxy())     driver = webdriver.firefox(firefox_profile=profile)     proxy.new_har("impression")     driver.get("https://www.google.com/")     server.stop()     driver.quit()     #success   browsermobproxy import server server = server("location/browsermob-proxy-2.0-beta-9/bin/browsermob-proxy") server.start() our_proxy = server.create_proxy()  selenium import webdriver our_browser = browser.upper() desired_capabilities = webdriver.desiredcapabilities.firefox # default desired_capabilities["version"] = configs[browser]["browser-version"] desired_capabilities["platform"] = configs[browser]["os"] desired_capabilities["idle-timeout"] = "25" desired_capabilities["max-duration"] = "300" desired_capabilities["command-timeout"] = "30" desired_capabilities["name"] = test_name desired_capabilities["browsername"] = browser desired_capabilities['loggingprefs'] = {"browser":"all"} this_proxy = proxy({    "httpproxy":our_proxy.selenium_proxy().httpproxy,    "sslproxy":our_proxy.selenium_proxy().sslproxy,    "proxytype":"manual",   "autodetect":false }) this_proxy.add_to_capabilities(desired_capabilities)  driver = webdriver.remote(     desired_capabilities = desired_capabilities )  proxy.new_har("impression")     driver.get("https://www.google.com/")     #fails     #urllib2.urlerror: <urlopen error [errno 61] connection refused>  server.stop() driver.quit() 

desired_capabilites remote , firefoxprofile respectively:

{'name': 'abdc', 'javascriptenabled': true, 'idle-timeout': '25', 'command-timeout': '30', 'max-duration': '300', 'platform': 'windows 7', 'browsername': 'firefox', 'version': '28', 'proxy': {'proxytype': 'manual', 'sslproxy': 'localhost:9117', 'httpproxy': 'localhost:9117'}, 'loggingprefs': {'browser': 'all'}}

{u'rotatable': false, u'takesscreenshot': true, u'acceptsslcerts': true, u'cssselectorsenabled': true, u'javascriptenabled': true, u'databaseenabled': true, u'locationcontextenabled': true, u'platform': u'darwin', u'browsername': u'firefox', u'version': u'29.0.1', u'nativeevents': false, u'applicationcacheenabled': true, u'webstorageenabled': true, u'browserconnectionenabled': true, u'handlesalerts': true}

i've seen ticket says issue resolved; doesn't seem so.

https://code.google.com/p/selenium/issues/detail?id=2051

i facing same error earlier. due process running on same port not letting browsermob proxy start. apache tomcat using same server.

either change port browsermob.

server = server(browsermob_location,options={'port':port_browsermob}) 

here port_browsermob port can specify.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -