browsermob-proxy icon indicating copy to clipboard operation
browsermob-proxy copied to clipboard

ERR_TUNNEL_CONNECTION_FAILED | python

Open iamkunalmittals opened this issue 2 years ago • 0 comments

i am facing "ERR_TUNNEL_CONNECTION_FAILED" error again and again. Please tell me how can i fix this .. my code is given below

`from selenium import webdriver from browsermobproxy import Server from webdriver_manager.chrome import ChromeDriverManager

Set up BrowserMob Proxy

server = Server(r"\browsermob-proxy-2.1.4\bin\browsermob-proxy") server.start() proxy = server.create_proxy()

Set up Chrome driver with proxy settings

chrome_options = webdriver.ChromeOptions() chrome_options.add_argument("--proxy-server={0}".format(proxy.proxy)) chrome_options.add_argument("--proxy-bypass-list=*dev.abccorp.com"); driver = webdriver.Chrome(chrome_options=opts, executable_path = ChromeDriverManager().install())

Start capturing network traffic

proxy.new_har("my_website")

Navigate to a website

driver.get("https://www.google.com")

Stop capturing traffic and save HAR file

har = proxy.har with open("my_website.har", "w") as har_file: har_file.write(str(har))

Quit the browser and proxy server

driver.quit() server.stop() `

iamkunalmittals avatar Feb 23 '23 05:02 iamkunalmittals