Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERR_TUNNEL_CONNECTION_FAILED | python #899

Open
iamkunalmittals opened this issue Feb 23, 2023 · 0 comments
Open

ERR_TUNNEL_CONNECTION_FAILED | python #899

iamkunalmittals opened this issue Feb 23, 2023 · 0 comments

Comments

@iamkunalmittals
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant