Skip to content

ERR_TUNNEL_CONNECTION_FAILED | python  #899

@iamkunalmittals

Description

@iamkunalmittals

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()
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions