I have upgraded the application from selenium 3 to selenium 4 and found that some of the test cases getting failed after upgradation with below error message.
com.thoughtworks.selenium.SeleniumException: Timed out waiting for action to finish
at com.thoughtworks.selenium.webdriven.Timer.run(Timer.java:46)
at com.thoughtworks.selenium.webdriven.WebDriverCommandProcessor.execute(WebDriverCommandProcessor.java:181)
at com.thoughtworks.selenium.webdriven.WebDriverCommandProcessor.doCommand(WebDriverCommandProcessor.java:95)
at com.thoughtworks.selenium.DefaultSelenium.waitForPageToLoad(DefaultSelenium.java:816)
The test cases are getting failed on below line.
SeleniumSession.get().waitForPageToLoad();
SeleniumSession is internal class which is extending DefaultSeleniumSession class
The default timeout configured for these test cases is 3 min.
Can you please help to understand how we can fix this issue. Or do we have any alternate method in selenium 4 to achieve the waitForPageToLoad.
Thanks.
If you are getting this error you may use the
WebDriverWaitlike belowOR
You can use the
PageLoadStrategythat introduce in selenium 4. Like belowYou can also combine the above both and use it like this
You can read more about the
PageLoadStrategyfrom hereimport