I have a JMeter Webdriver script which works correctly during all scenario steps. But in case of slowly getting response after changes on page making by script, sometimes following error happens:
Response code:500
Response message:javax.script.ScriptException: javax.script.ScriptException: org.openqa.selenium.TimeoutException: Expected condition failed: waiting for element to be clickable: By.xpath: //<some_xpath>] (tried for 30 second(s) with 500 milliseconds interval)
The issue connected specifically with selenium settings to wait only 30 seconds and not more in the context of slowly working functionality on the page (which needed sometimes more time for page changes than 30 sec).
If the step of Selenium script could take sometimes >30 seconds (due to possible slow response), how is it possible to switch off default 30 sec limit and wait until success? I do not need to see error after only 30 seconds, I need to wait until it goes to the next step in script - whatever time it takes. So, I don't want to have any limit at all to prevent scenario interruption in the middle, I'm ready to wait whatever it will take.
I didn't set any limits by my own:
driver = vars.getObject("driver");
wait = vars.getObject("wait");
Could you please advice, what is the best way to switch off this 30 sec default limit?
Take a look at WebDriver.Timeouts
Example usage:
driver.manage().timeouts().implicitlyWait(java.time.Duration.of(5, java.time.temporal.ChronoUnit.MINUTES))
Alternatively you can use WebDriver Waits
More information on Groovy scirpting in JMeter: Apache Groovy: What Is Groovy Used For?