SeleniumHQ / SeleniumHQ/selenium

[🚀 Feature]: Configurable HTTP Client settings across bindings

Open
#12,368 27 comments 4 reactions 1 assignee Claimed by @titusfortner View on GitHub
A-needs new owner C-dotnet C-java C-nodejs C-py C-rb I-enhancement J-stale
Dominant language
Java
Stars
34.5k
Forks
8.7k
Avg merge
2d 1h
Merged PRs (30d)
92

Description

### Status
Python: https://github.com/SeleniumHQ/selenium/pull/13286 (partial)
Java:
Ruby: (blocked by #16269)
JS: (blocked by #16269)
.NET: (blocked by #16269)

### Feature and motivation

*Update*: Here's the example page describing client settings and what all examples need to be added and what features still need to be implemented: [WIP - HTTP Client Documentation](https://deploy-preview-1433--selenium-dev.netlify.app/documentation/webdriver/drivers/http_client/)

I went down a rabbit hole of timeout settings in Selenium between the different bindings, and what the defaults are and what can be configured. *Edit: added WebDriverIO for reference*

Language | Max Redirects | Read Timeout | Configurable
-- | -- | -- | --
Python | 3 | ∞ | No
Ruby | 20 | 60 | Timeout, not redirects
Java | 100 | 180 | Timeout, not Redirects
.NET | 50 | 60 | No
JS | ∞ | ∞ | No
*(WDIO)* | 3 | 120 | Yes
**recommended** | 20 | 120 | Yes!

According to Jari, Max Redirect should be 20.(https://github.com/SeleniumHQ/selenium/commit/93eee69ac30c0aabe34c092d0e14bf19e37c0a30)

It is also problematic that the default page load timeout is 300 when the read timeout in most languages is so much less (the driver will wait for the page long after the code errors and can't send a quit command). I'm not sure why it was set that high in the first place? I think we should change the defaults across the board to be 120 second read timeout and 115 second page load timeout.

### Usage example

```java
ClientConfig config = ClientConfig.defaultConfig().readTimeout(Duration.ofSeconds(300)).redirects(25).baseUrl(url)
```

```rb
http_client = Selenium::WebDriver::Remote::Http::Default.new(timeout: 300, redirects: 25)
```

```py
client_config = ClientConfig()
client_config.timeout = 300
client_config.redirects = 25
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.