1

After button click page get refresh and redirect to another page.In my case after button click i gave timeout for page refresh but after button click it showing timeout exception without time wait .i used all type of time wait event i used thread.sleep() but no use.


Exception :

FAILED: createEventTest org.openqa.selenium.TimeoutException: Timed out waiting for page load. Command duration or timeout: 15.08 seconds Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46' System info: host: 'pc', ip: '192.168.1.6', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.7.0_79' Session ID: a29803a6-5ec1-4791-b26f-3ab0adb47c7b Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{platform=WINDOWS, acceptSslCerts=true, javascriptEnabled=true, cssSelectorsEnabled=true, databaseEnabled=true, browserName=firefox, handlesAlerts=true, nativeEvents=false, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=46.0.1}] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678) at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:327) at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.openqa.selenium.support.pagefactory.internal.LocatingElementHandler.invoke(LocatingElementHandler.java:51) at com.sun.proxy.$Proxy6.click(Unknown Source) at com.pv.pages.CreateEventPage.createApprovedEvent(CreateEventPage.java:356) at com.pv.pages.CreateEventPage.createEvent(CreateEventPage.java:688) at com.pv.tests.CreateEventTests.createEventTest(CreateEventTests.java:39) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86) at org.testng.internal.Invoker.invokeMethod(Invoker.java:643) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112) at org.testng.TestRunner.privateRun(TestRunner.java:782) at org.testng.TestRunner.run(TestRunner.java:632) at org.testng.SuiteRunner.runTest(SuiteRunner.java:366) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319) at org.testng.SuiteRunner.run(SuiteRunner.java:268) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1246) at org.testng.TestNG.runSuitesLocally(TestNG.java:1171) at org.testng.TestNG.run(TestNG.java:1066) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:113) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:206) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:177) Caused by: org.openqa.selenium.TimeoutException: Timed out waiting for page load. Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46' System info: host: 'pc', ip: '192.168.1.6', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.7.0_79' Driver info: driver.version: unknown at .Utils.installClickListener/e<(file:///C:/Users/fu/AppData/Local/Temp/anonymous7103862578695056607webdriver-profile/extensions/[email protected]/components/command-processor.js:9372) at .WebLoadingListener/e(file:///C:/Users/fu/AppData/Local/Temp/anonymous7103862578695056607webdriver-profile/extensions/[email protected]/components/command-processor.js:5142) at .WebLoadingListener/<(file:///C:/Users/fu/AppData/Local/Temp/anonymous7103862578695056607webdriver-profile/extensions/[email protected]/components/command-processor.js:5150) at .fxdriver.Timer.prototype.setTimeout/<.notify(file:///C:/Users/fu/AppData/Local/Temp/anonymous7103862578695056607webdriver-profile/extensions/[email protected]/components/command-processor.js:625)

3
  • Share your Selenium code also. Commented Aug 11, 2016 at 7:27
  • Code: //Clicking button createEvent_btn.click(); //I used explicit and Implicit time wait even i used thread.sleep() but no use. lib.implicitWait(1, TimeUnit.MINUTES); Commented Aug 11, 2016 at 7:43
  • @Gobi Your question lacks code, formatting and methods already used, I think. Please refer to StackOverflow guidelines for formatting. As to question itself, have you tried waitFor(ExpectedCondition<T>)? Commented Aug 11, 2016 at 8:03

2 Answers 2

0

Tried this?

driver.manage().timeouts().pageLoadTimeout(10,TimeUnit.SECONDS);
Sign up to request clarification or add additional context in comments.

Comments

0

I used to javascript for page load .Now my code running fine.

public static void waitForPageToLoad() {

do {

js = (JavascriptExecutor) driver;

pageLoadStatus = (String)js.executeScript("return document.readyState");

System.out.print(".");

} while ( !pageLoadStatus.equals("complete") );

System.out.println();

System.out.println("Page Loaded.");

}

Comments

Your Answer

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.