Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java中的Selenium网格:org.openqa.Selenium.SessionNotCreatedException:无效参数:can';无法终止已退出的进程_Java_Selenium_Selenium Grid - Fatal编程技术网

Java中的Selenium网格:org.openqa.Selenium.SessionNotCreatedException:无效参数:can';无法终止已退出的进程

Java中的Selenium网格:org.openqa.Selenium.SessionNotCreatedException:无效参数:can';无法终止已退出的进程,java,selenium,selenium-grid,Java,Selenium,Selenium Grid,我想用Java编写一个Selenium网格应用程序 上面表示节点已连接到集线器 在客户端,我想写以下内容: try { DesiredCapabilities capability = DesiredCapabilities.firefox(); WebDriver driver = new RemoteWebDriver(new URL("http://IP of Hub:4444/wd/hub"), capability); capabili

我想用Java编写一个Selenium网格应用程序

上面表示节点已连接到集线器

在客户端,我想写以下内容:

try {
        DesiredCapabilities capability = DesiredCapabilities.firefox();

        WebDriver driver = new RemoteWebDriver(new URL("http://IP of Hub:4444/wd/hub"), capability);
        capability.setBrowserName("firefox");
        driver.get("https://www.google.com");

} catch (MalformedURLException ex) {
        System.err.println("URL Exception: "+ex.getMessage());
}
很遗憾,运行客户端应用程序时引发了以下异常:

    Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: invalid argument: can't kill an exited process
...
Driver info: driver.version: unknown

在初始化webdriver实例之前提供geckodriver路径

try {
     DesiredCapabilities capability = DesiredCapabilities.firefox();
     System.setProperty("webdriver.gecko.driver", "/PATH_OF_DRIVER/geckodriver.exe");
     driver = new RemoteWebDriver(new URL("http://Hub_IP/wd/hub"), capability);
     capability.setBrowserName("firefox");
     driver.get("https://www.google.com");

} catch (MalformedURLException ex) {
     System.err.println("URL Exception: "+ex.getMessage());
}

解决方案:Linux中的geckodriver(节点)有问题。
我在Windows PC上添加了一个节点,它正常工作。

它仍然引发完全相同的异常。我还尝试在节点上设置path变量:chmod u+x geckodriver和export path=$path:/path\u OF_GECKO/geckodriver您是否还可以确保非root用户具有访问geckdriver的可执行权限?权限为:-rwxrwx