I've wanted to write a Selenium Grid app in Java.
- Hub: selenium-server-standalone-3.141.59.jar on Windows 10
- Node: selenium-server-standalone-3.141.59.jar on Linux Debian
- Node Firefox version: 60.6.1esr (64-bit)
- Node GeckoDriver version: 0.26.0
- Selenium version in client POM: 3.3.1 (client and hub is the same machine)
On http://localhost:4444/grid/console it says that the node is connected to the hub with the NodeIP I gave the node by passing -host when adding the node (see later).
On the client-side I've wanted to write the following:
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());
}
Unfortunately, the following exception was thrown when running the client app:
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: invalid argument: can't kill an exited process
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'hlkali', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.0-kali4-amd64', java.version: '1.8.0_212'
Driver info: driver.version: unknown
remote stacktrace:
Command duration or timeout: 0 milliseconds
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:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:367)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:113)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:158)
at com.mycompany.selenium_grid_client.Selenium_Grid.main(Selenium_Grid.java:28)
...
I started the Node with -host:
java -Dwebdriver.gecko.driver="/home/myuser/Downloads/geckodriver" -jar selenium-server-standalone-3.141.59.jar -role webdriver -hub http://HubIP:4444/grid/register -port 5566 -host NodeIP
I realized that the NodeIP is not the IP from the exception:
System info: host: 'hlkali', ip: '127.0.1.1'
maybe this is the reason, but I do not know how to solve this.