Is there a way to increase the selenium timeout value on the Chrome-driver level ?

711 views
Skip to first unread message

Chun Ji

unread,
Nov 25, 2019, 9:22:58 PM11/25/19
to chromedri...@googlegroups.com
Hi all, 
We have just created a new cluster on K8S network.  It is a brand new environment, and  we are to try the black box testing from the Client end. 
1) If I was using our existing selenium suites to run, I have seen tons of exceptions as element were not found. 
2) But if I was to test it piece by piece manually, and wait a little longer,  I can see some failures are performance related. 

So is there a way I can increase the default timeout value on ChromeDriver level, that I can check which is which ? 

Thanks, 

Jack 


T Crichton

unread,
Nov 26, 2019, 11:41:03 AM11/26/19
to ChromeDriver Users
Hi Jack,
I don't think there's a way to query for the current timeout values, but they are echoed into the verbose ChromeDriver log on startup and whenever the values are changed. Look for RESPONSE InitSession. The default values are:
      "timeouts": {
         "implicit": 0,
         "pageLoad": 300000,
         "script": 30000

Implicit is for finding elements and other commands, pageLoad is for Navigate tasks, script is for executeScript and executeAsyncScript.

Timeouts can be set in ChromeOptions, or set after the driver is created. The exact syntax depends on which language you are using.

In Java, using Options:
Map<String, Object> timeouts = new HashMap<>();
timeouts.put("implicit", 10);
timeouts.put("pageLoad", 20);
timeouts.put("script", 15);
ChromeOptions options = new ChromeOptions();
options.setCapability("timeouts", timeouts);

In Java, setting with the driver:
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(20, TimeUnit.SECONDS);
driver.manage().timeouts().setScriptTimeout(4, TimeUnit.SECONDS);

See the API docs for commands in other languages: https://selenium.dev/downloads/ (look for API Docs)

You can also use WebDriverWait, which will retry a command until it is successful, or the specific timeout expires. It gives you more control over which commands use timeouts. See the documentation for more details.

- Tricia

Chun Ji

unread,
Nov 26, 2019, 9:06:34 PM11/26/19
to T Crichton, ChromeDriver Users
Thanks for the tips. 

-Jack 


--
You received this message because you are subscribed to the Google Groups "ChromeDriver Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromedriver-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chromedriver-users/7bc912a5-d83f-40c0-86cb-47a8532dde03%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages