简体   繁体   中英

Selenium Grid: DevToolsActivePort file doesn't exist (unknown error: Chrome failed to start: exited abnormally)

I am trying to use Selenium Grid in order to automate some tests. In order to optimize the tests' time, I created some VMs working on LINUX Platform (one VM works as a Selenium hub and the other VMs work as Selenium nodes). There is no problem while starting the standalone server neither in the hub nor in the nodes (All worked as well as supposed: the node has been successfully connected to the hub). But when trying to execute a java code that tests the remoteWebDriver (using chrome) I got a window full of warnings and errors. I think that the chromedriver is not happy..? Does someone know how to solve this problem?

Below is the java code I am using:

import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

public class GithubTest {

  public static void main(String[] args) throws MalformedURLException{
    String toBeTestedUrl = "https://github.com";
    String nodeUrl = "http:172.20.10.13:5555/wd/hub";
    DesiredCapabilities desiredCapabilities = DesiredCapabilities.chrome();
    desiredCapabilities.setBrowserName(DesiredCapabilities.chrome().getBrowserName());
    desiredCapabilities.setPlatform(Platform.LINUX);
    WebDriver driver = new RemoteWebDriver(new URL(nodeUrl), desiredCapabilities);


    driver.get(toBeTestedUrl);

    if(driver.getTitle().equalsIgnoreCase("The world’s leading software development platform · GitHub"))
        System.out.println("OK!");
    else 
        System.out.println("ERROR!");

    driver.quit();
  }
}

And below is the log file in the selenium node:

16:48:24.098 INFO - Selenium build info: version: '3.9.1', revision: '63f7b50'
16:48:24.108 INFO - Launching a Selenium Grid node on port 5555
16:48:26.313 INFO - Selenium Server is up and running on port 5555
16:48:26.313 INFO - Selenium Grid node is up and ready to register to the hub
16:48:26.344 INFO - Starting auto registration thread. Will try to register every 5000 ms.
16:48:26.345 INFO - Registering the node to the hub: http://172.20.10.10:4444/grid/register
16:48:26.442 INFO - Updating the node configuration from the hub
16:48:26.483 INFO - The node is registered to the hub and ready to use
16:49:08.370 INFO - Found handler:       org.openqa.selenium.remote.server.commandhandler.BeginSession@cdb1ecc
16:49:08.374 INFO - /session: Executing POST on /session (handler: BeginSession)
16:49:08.503 INFO - Capabilities are: Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}, platform: LINUX}
16:49:08.505 INFO - Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}, platform: LINUX} matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)

The errors log while executing the java class:

  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 5.0.0-36-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 112 milliseconds
Build info: version: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:42:28.403Z'
System info: host: 'SeleniumNode1', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.0.0-36-generic', java.version: '11.0.4'
Driver info: driver.version: unknown
Command duration or timeout: 288 milliseconds
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
        at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
        at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
        at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
        at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
        at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:138)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:155)
        at GitTest.main(GitTest.java:19)
Caused by: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 5.0.0-36-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 112 milliseconds
Build info: version: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:42:28.403Z'
System info: host: 'SeleniumNode1', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.0.0-36-generic', java.version: '11.0.4'
Driver info: driver.version: unknown
Build info: version: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:42:28.403Z'
System info: host: 'SeleniumHub', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.0.0-36-generic', java.version: '11.0.4'
Driver info: driver.version: unknown
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
        at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
        at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
        at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
        at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
        at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
        at org.openqa.selenium.remote.server.RemoteSession$Factory.performHandshake(RemoteSession.java:145)
        at org.openqa.selenium.remote.server.ServicedSession$Factory.apply(ServicedSession.java:154)
        at org.openqa.selenium.remote.server.ActiveSessionFactory.lambda$apply$12(ActiveSessionFactory.java:176)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:442)
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
        at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
        at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
        at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
        at org.openqa.selenium.remote.server.ActiveSessionFactory.apply(ActiveSessionFactory.java:179)
        at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$null$2(NewSessionPipeline.java:65)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
        at java.util.Collections$2.tryAdvance(Collections.java:4747)
        at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
        at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
        at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$createNewSession$3(NewSessionPipeline.java:68)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.util.stream.DistinctOps$1$2.accept(DistinctOps.java:175)
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
        at java.util.stream.Streams$StreamBuilderImpl.tryAdvance(Streams.java:397)
        at java.util.stream.Streams$ConcatSpliterator.tryAdvance(Streams.java:720)
        at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
        at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
        at org.openqa.selenium.remote.server.NewSessionPipeline.createNewSession(NewSessionPipeline.java:71)
        at org.openqa.selenium.remote.server.commandhandler.BeginSession.execute(BeginSession.java:65)
        at org.openqa.selenium.remote.server.WebDriverServlet.lambda$handle$0(WebDriverServlet.java:242)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.lang.Thread.run(Thread.java:834) ``` 



First thing to check is that you're using the correct Chrome driver to drive your Chrome Browser. If you're not sure, check your Chrome version and download the driver again from http://chromedriver.chromium.org/downloads . As far as i can see your ChromeDriver is 2.41, which supports Chrome v67-69 only so it could be the compatibility reason.

If it does not help, you might need to add extra arguments into your driver initialization

chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome('/path/to/your_chrome_driver_dir/chromedriver',chrome_options=chrome_options)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM