RE: Explicit wait while page is loading

Hi,
I am using Explicit Wait, but I am not getting “NoSuchElementFound”exception when the page is loading even after the time specified in the WebDriverWait object. Just wanted to know, if there are any wait methods which will act, if the page is being loaded. I am using Selenium WebDriver in Java
Thank You!

mohan191289 Default Asked on January 5, 2015 in Selenium WebDriver.
Add Comment
2 Answers

Timeout Test in TestNG

When a test method is taking longer time than the specified time (in milliseconds) to execute, then that test method will be terminated and marked as failed, this feature is available in both JUnit 4 and TestNG.

While running test methods there can be cases where certain test methods get struck or may take longer time than to complete the execution than the expected. We need to handle these type of cases by specifying Timeout and proceed to execute further test cases / methods

TestNG Example:

When we execute the above program, it will display the output as “2 tests executed.
Test Method : sampleTestCase – PASSED

Test Method : executetimeOut – FAILED
Error – org.testng.internal.thread.ThreadTimeoutException: Method org.testng.internal.TestNGMethod.executePass() didn’t finish within the time-out 1000

The second method will be marked as Fail, because the execution is not completed in the specified timeOut period. Hence it will stop the execution forcibly and returns as FAILED

The Method will return as “PASSED”, if we change the value of milliseconds to lessthan 1000 which specified in timeout. As “Thread.sleep(500);”. The test will complete the executing within the timeout period, hence this will return as “Passed”

Train Answered on January 22, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.