Selenium ChromeDriver Stop receiving a message from a render exception

In my Java project, I use Selenium for web automation. I am using the chromedriver v2.20 executable. First, the "ChromeDriverService" is initialized and used to create a ChromeDriver of the type "new ChromeDriver (service, features)". I also use BrowserMobProxy to capture all web requests. In my test, I type several URLs several times, after each navigation driver implicitly waits for several seconds, then the results of the survey. But while Execution it gives me an Exception timeout.

In my research, I found solutions that do not work for me:

  • Instead of implicitlyWait use Thread.sleep
  • Replace the new RemoteWebDriver (service.getUrl (), features); Using the new ChromeDriver (services, features);
  • After the new ChromeDriver (...), wait 1 second using Thread.sleep (1000);

Can someone 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);
        }
    }
}

, : 127.0.0.1:57086, : 'socket' ChromeDriver 2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b) 13817 . SLF4J: "org.slf4j.impl.StaticLoggerBinder". SLF4J: (NOP) SLF4J: . http://www.slf4j.org/codes.html#StaticLoggerBinder. . . [723.497] [SEVERE]: : 600 000 [1323.497] [SEVERE]: : 600.000

:

org.openqa.selenium.WebDriverException: : : : 600.000 ( : chrome = 45.0.2454.101)
( : chromedriver = 2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b), = Linux 3.19.0-28-generic x86_64) (: ) : 1200.01 : : "2.48.2", : '41bccdd10cf2c0560f637404c2d96164b67d9d67', : '2015-10-09 13:08:06 ' : 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" : org.openqa.selenium.chrome.ChromeDriver [{applicationCacheEnabled = false, rotatable = false, mobileEmulationEnabled = , = {UserDataDir =/TMP/.com.google.Chrome.rgDfCi}, takeHeapSnapshot = true, databaseEnabled = false, handleAlerts = true, hasTouchScreen = false, version = 45.0.2454.101, platform = LINUX, browserConnectionEnabled = false, nativeEvents = true, acceptSslCerts = true, locationContextEnabled = true, webStorageEnabled = true, browserName = chrome, Screenshot = true, javascriptEnabled = true, cssSelectorsEnabled = true}] : a97aeb9a53ddd77e8edfac64019cc599 at sun.reflect.NativeConstructorAccessorImpl.newInstance0 ( )    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)    java.lang.reflect.Constructor.newInstance(Constructor.java:422)    org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)    org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)    org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)    org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:311)    org.openqa.selenium.remote.RemoteWebDriver $RemoteNavigation.to(RemoteWebDriver.java:927)    app.core.browsers.chrome.Chrome.navigateTo(Chrome.java:112) app.core.extensions.tests.ShouldPostToServerTest.nav(ShouldPostToServerTest.java:58)    app.core.extensions.tests.ShouldPostToServerTest.setTest(ShouldPostToServerTest.java:49)

+4
1

. , -. chrome.

+4

Source: https://habr.com/ru/post/1625345/


All Articles