I've wanted to write a Selenium Grid app in Java.
On http://localhost:4444/grid/console it says that the node is connected to the hub.
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
...
Driver info: driver.version: unknown
Provide geckodriver path before initializing a webdriver instance,
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());
}
Solution: There was something wrong with the geckodriver in Linux (node). I added a node on a Windows PC and it worked.
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.