-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[🐛 Bug]: Timeout env variable GLOBAL_DEFAULT_TIMEOUT has no effect #15604
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
Comments
@justinjosephmkj, thank you for creating this issue. We will troubleshoot it as soon as we can. Selenium Triage Team: remember to follow the Triage Guide |
Thanks for reporting this. I just confirmed that Some notes: The logic for setting
This sets the value to whatever is passed in when the class is initialized, even if The existing logic will also break if:
... so those need to be considered when fixing. The |
Can I work on this ? |
@XueSongTap yea, of course. Submit a Pull Request with the fix and link it to this issue. You should probably add some tests for this too. If you have any questions about contributing or anything else, you can submit a draft pull request and tag me in the comments.. or ask anyone for help in the Slack channel: |
@cgoldberg @XueSongTap - I'm not sure if this is 100% the same issue, but it seems related enough to mention. Occasionally, I deal with web pages that have absurdly long page generation times that I have no control over. By default, Selenium's read timeout is 120 seconds, which isn't always long enough. Here's a Python function that I've been using to dynamically increase/decrease the timeout from 120 seconds to whatever amount of time I need:
Here's an example of how I use it:
My function works correctly, but throws a deprecation warning:
I don't quite understand what I'm supposed to do here and couldn't find much relevant documentation. Is there a simple drop-in replacement for the |
Where does |
@Pikamander2 it is a frustrating thing that the default Page Load Timeout value is much greater than the default read timeout values of all the http clients out there. Unless you change a setting you can never get a page load timeout. If you really need longer than 2 minutes for a page to load (and if so, I'm really sorry you work wherever you work), you can change it here: https://www.selenium.dev/documentation/webdriver/drivers/http_client/ |
Typically you would set an environment variable to override something set in code... otherwise it would be pretty useless. So maybe it should be named better ( In #15628 that is up for review, it defines the behavior as:
To me, that sounds correct. AFAIK, it isn't even documented anywhere, so I have no idea how people could know about it without diving into the code. |
Ah, looks like this is the same issue as #15620 So this makes sense: Aha, no, it comes from this #14696 The right way to do this is to just do |
@titusfortner, I think yes, since they mentioned in their README https://github.com/appium/python-client/blob/f59f23df08e7e3c4f64d63afcb81d22445d21010/README.md?plain=1#L429 |
@KazuCocoa can we deprecate this environment variable and have people use What do you think is best for this? |
Yes, it's fine for us to deprecate/remove it. We just put that from selenium bindings. We'll update the documentation when it gets deprecated/removed. |
So should we deprecate |
I forgot that it's not actually working right now. Would it make sense to check if someone is trying to use it and throw a warning saying to use setdefaulttimeout()? I'm ok just deleting it, too, depends on how I'm feeling in any given moment the route I'd go. 😂 |
I'd prefer to remove it so we don't have to remember to remove the warning eventually. Since it doesn't currently work, nobody would be any worse off than they are today. |
This issue is looking for contributors. Please comment below or reach out to us through our IRC/Slack/Matrix channels if you are interested. |
I just opened #15672 that is related to your issue.
You should be able to do this:
If #15672 gets implemented, you could then do:
|
Description
The timeout is always set to 120 seconds, the env variable has GLOBAL_DEFAULT_TIMEOUT has no effect.
https://github.com/SeleniumHQ/selenium/blob/ecb0dbf91415b10d718acf28afefc16654a9f13a/py/selenium/webdriver/chromium/remote_connection.py#L33
client_config = client_config or ClientConfig( remote_server_addr=remote_server_addr, keep_alive=keep_alive, timeout=120 )
https://github.com/SeleniumHQ/selenium/blob/ecb0dbf91415b10d718acf28afefc16654a9f13a/py/selenium/webdriver/remote/client_config.py#L107
self.timeout = ( ( float(os.getenv("GLOBAL_DEFAULT_TIMEOUT", str(socket.getdefaulttimeout()))) if os.getenv("GLOBAL_DEFAULT_TIMEOUT") is not None else socket.getdefaulttimeout() ) if timeout is None else timeout )
Others:
https://github.com/SeleniumHQ/selenium/blob/ecb0dbf91415b10d718acf28afefc16654a9f13a/py/selenium/webdriver/firefox/remote_connection.py#L35
https://github.com/SeleniumHQ/selenium/blob/ecb0dbf91415b10d718acf28afefc16654a9f13a/py/selenium/webdriver/safari/remote_connection.py#L35
Reproducible Code
Debugging Logs
The text was updated successfully, but these errors were encountered: