We are currently using a remote cloud grid for web automation and are encountering WebDriver timeouts. Is there a way to increase the WebDriver connection timeout when creating a RemoteWebDriver session?
Hey @ananya_dutta
Thank you for reaching out to us,
Yes, the default WebDriver request timeout can be increased by configuring higher HTTP timeouts for communication between the test code and the Selenium TestMu AI cloud grid.
ClientConfig clientConfig = ClientConfig.defaultConfig()
.connectionTimeout(Duration.ofMinutes(5))
.readTimeout(Duration.ofMinutes(20));
RemoteWebDriver driver = RemoteWebDriver.builder()
.oneOf(chromeOptions)
.address("https://hub.lambdatest.com/wd/hub")
.config(clientConfig)
.build();
Creates a custom HTTP configuration for Selenium.
- connectionTimeout (configured for 5 minutes): Defines how long Selenium will wait to establish a connection to the remote WebDriver server
- readTimeout (configured for 20 minutes): Defines how long Selenium waits for a response from the server after sending a command
As seen below, the Appium session was active for 9+ minutes before it was eventually cancelled by the user.
You can also find a sample example here.
