0

I get a timeout error after clicking a button (not a page load) in Selenium for Java. The button triggers a recalculation and causes the cursor to spin and be unavailable for the 5-6 minutes until the calculation has completed.

I have added these lines to try and extend the wait time, but it has not helped:

 driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(300));
 driver.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(300));
 driver.manage().timeouts().scriptTimeout(Duration.ofSeconds(300)); 

These should give me 5 minutes before triggering the error, but I get a time out at 3 minutes.

I have seen other answers that suggest adding a wait statement after the click statement, however, this will not work because the test fails before it could get to and execute that wait (the click statement still is active, and the test fails).

I believe that since it is failing at 3 minutes (and the wait statements are set at 5), this is unrelated to the standard wait strategies, and there must be some other method to adjust the timeout for longer running processes within tests. Please help me out, thanks.

asked Jun 27, 2023 at 19:28

1 Answer 1

0

You need to actually provide a sample of your click action and the code directly after it to provide enough information for people to work with in my opinion.

As a workaround for now you could implement a thread sleep directly after clicking the button, which should guarantee your wait. This is however not exactly ideal.

try {
 TimeUnit.MINUTES.sleep(7);
} catch (InterruptedException e) {
 Thread.currentThread().interrupt();
}
answered Jul 5, 2023 at 13:17

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.