question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python Selenium 4.0.0 - Does not respect no_proxy variable but respects http_proxy and https_proxy

See original GitHub issue

🐛 Bug Report

I upgraded python selenium 4.0.0 and when the tests run the request to the webdriver on localhost is sent to the proxy specified in environment variable https_proxy. The no_proxy variable is pecified to exclude localhost.

To Reproduce

  1. Define proxy environment variables in your shell

Run selenium tests inside the shell. Requests to the webdriver on localhost is sent to the proxy even though no_proxy is defined.

When the reqeuest to localhost went to the proxy it was caught in the proxy protection solution and returned an erorr page that localhost is not categorized. :

<b>Blocked Category</b>: none<br>
<b>Internet Address</b>: http://localhost&#x2F;session <br>

The request shouldn’t have been sent to the proxy in the first place.

Expected behavior

Both the values in http(s)_proxy and no_proxy should be respected.

This works in python selenium 3.141.0

Test script or set of commands reproducing this issue

Define environment variables in the shell:

export https_proxy=http:\\server:port
export http_proxy=http:\\server:port
export no_proxy=localhost

Run your selenium test:

python my_test.py

Environment

OS: Windows 10 Browser: Chrome Browser version: 94.0.4606.71 Browser Driver version: ChromeDriver 94.0.4606.61 Language Bindings version: python selenium 4.0.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
AutomatedTestercommented, Oct 22, 2021

cool, thanks, I have added these to test cases and things still look good.

0reactions
github-actions[bot]commented, Nov 22, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

requests: how to disable / bypass proxy - Stack Overflow
The only way I'm currently aware of for disabling proxies entirely is the following: Create a session; Set session.trust_env to False; Create your...
Read more >
We need to talk: Can we standardize NO_PROXY? - GitLab
Today, most Web clients support connection to proxy servers via environment variables: http_proxy / HTTP_PROXY; https_proxy / HTTPS_PROXY ...
Read more >
Set a network range in the no_proxy environment variable
I'm testing with wget and it always tries to query the proxy, whatever IP address I want to connect to. Since lots of...
Read more >
WebDriverManager - Boni García
Selenium WebDriver is a library that allows controlling web browsers programmatically. It provides a cross-browser API that can be used to ...
Read more >
Python Requests Module To Configure And Use Proxies - Zyte
Sending HTTP requests in Python is not necessarily easy. ... But choosing the tool which is most suitable for your needs is just...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found