In my Java project I am using Selenium for web automation. I am using chromedriver v2.20 executable. First "ChromeDriverService" is initialised and that is used to create ChromeDriver like, "new ChromeDriver(service, capabilities);". Also I used BrowserMobProxy to capture all web requests. In my test I navigate to some URLs multiple times, after each navigation driver implicitly waits for few seconds, then polls result. But while Execution it gives me timeout Exception.
In my research I came across solutions which are not working for me:
Can anyone please tell me why this error occurs ? how to handle this ?
ShouldPostToServerTest.java:
@Test
public void setTest() throws Exception {
for (int i = 0; i < 3; i++) {
nav();
poll();
}
}
private void nav() {
String[] navTo = {"http://www.bestbuy.com","http://www.amazon.com"};
for (int n = 0; n < 30 / navTo.length; n++) {
for (String url : navTo) {
chrome.navigateTo(url);
chrome.waitFor(5000);
}
}
}
private void poll() {
int pollInterval = 1000;
int remaining = 120 * 1000;
boolean found = false;
while (remaining > 0) {
if (found) // populateResult(), omitted for now.
break;
chrome.waitFor(pollInterval);
remaining -= pollInterval;
}
}
Chrome.java:
public void navigateTo(String url) {
if (driver == null)
return;
driver.navigate().to(url); // TimeOut
}
public void waitFor(long waitFor) {
long start = System.currentTimeMillis();
driver.manage().timeouts().implicitlyWait(waitFor, TimeUnit.MILLISECONDS);
long duration = System.currentTimeMillis() - start;
long remaining = waitFor - duration;
if (remaining > 0) {
try {
Thread.sleep(remaining);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
Error stack trace:
Connected to the target VM, address: '127.0.0.1:57086', transport: 'socket'
Starting ChromeDriver 2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b) on port 13817
Only local connections are allowed.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Vector smash protection is enabled.
Vector smash protection is enabled.
[723.497][SEVERE]: Timed out receiving message from renderer: 600.000
[1323.497][SEVERE]: Timed out receiving message from renderer: 600.000
Exception:
org.openqa.selenium.WebDriverException: unknown error: cannot determine loading status from timeout: Timed out receiving message from renderer: 600.000 (Session info: chrome=45.0.2454.101)
(Driver info: chromedriver=2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b),platform=Linux 3.19.0-28-generic x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 1200.01 seconds Build info: version: '2.48.2', revision: '41bccdd10cf2c0560f637404c2d96164b67d9d67', time: '2015-10-09 13:08:06' System info: host: 'yogesh-ubuntu', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.19.0-28-generic', java.version: '1.8.0_60' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={userDataDir=/tmp/.com.google.Chrome.rgDfCi}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=45.0.2454.101, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}] Session ID: a97aeb9a53ddd77e8edfac64019cc599 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) 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:647) at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:311) at org.openqa.selenium.remote.RemoteWebDriver$RemoteNavigation.to(RemoteWebDriver.java:927) at app.core.browsers.chrome.Chrome.navigateTo(Chrome.java:112) at app.core.extensions.tests.ShouldPostToServerTest.nav(ShouldPostToServerTest.java:58) at app.core.extensions.tests.ShouldPostToServerTest.setTest(ShouldPostToServerTest.java:49)
Your code runs fine. Might be you using outdated chrome driver. I suggest to use latest exe of chrome driver.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With