Reputation: 11
I am using : java:1.8 Selenium: 3.141.59 jar Geco driver version: 0.25.0 Firefox version : 69.0.1
Below is the executable.bat file detail:
start java -jar C:/eclipse-workspace/Selenium_Grid/Config/selenium-server-standalone-3.141.59.jar -role hub
start java -Dwebdriver.chrome.driver=D:/Selenium/chromedriver_win32/chromedriver.exe -jar C:/eclipse-workspace/Selenium_Grid/Config/selenium-server-standalone-3.141.59.jar -role node -hub http://localhost:4444/grid/register -port 5558 -maxSession 5 -browser browserName=chrome,maxInstances=10
start java -Dwebdriver.gecko.driver=D:/Selenium/geckodriver-v0.25.0-win64/geckodriver.exe -jar C:/eclipse-workspace/Selenium_Grid/Config/selenium-server-standalone-3.141.59.jar -role node -hub http://localhost:4444/grid/register -port 5559 -maxSession 5
Configuration of Grid Hub and node
Below is the code :
public static RemoteWebDriver getBrowserDriver(final String browser)
throws MalformedURLException {
return new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),
getBrowserCapabilities(browser));
}
private static DesiredCapabilities getBrowserCapabilities(
final String browserType) throws MalformedURLException {
switch (browserType.toLowerCase()) {
case "firefox":
System.out.println("Opening firefox driver");
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setBrowserName("firefox");
capabilities.setPlatform(Platform.WIN10);
return capabilities;
}
}
On running code getting below exception log :
org.openqa.selenium.WebDriverException: Error forwarding the new session Empty pool of VM for setup Capabilities {acceptInsecureCerts: true, browserName: firefox, marionette: true, platform: WIN10, version: } Command duration or timeout: 801 milliseconds Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48' System info: host: 'GP-PIN-IS04', ip: '192.168.250.72', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_221' Driver info: driver.version: RemoteWebDriver Caused by: org.openqa.grid.common.exception.GridException: Error forwarding the new session Empty pool of VM for setup Capabilities {acceptInsecureCerts: true, browserName: firefox,
Upvotes: 1
Views: 1889
Reputation: 245
So your error says "Error forwarding the new session Empty pool of VM for setup Capabilities" which means it is looking for a node that matches the capabilities you asked for when creating the remote driver, but it cannot find one. In the line that is starting your geckodriver, you are not specifying a browser like you are for the chrome one. Probably it would be easier to create a node config file and pass it in when starting the node like this:
java -Dwebdirver.gecko.driver="D:/Selenium/geckodriver-v0.25.0-win64/geckodriver.exe" -jar selenium-server-standalone-3.8.1.jar -role node -hub "http://localhost:4444/grid/register/" -port 5559 -nodeConfig config.json
Here is what the config file for your firefox node could look like:
{
"capabilities": [
{
"browserName": "firefox",
"platform": "WIN10",
"maxInstances": 5
}
],
"hub": "http://<hub ip>:<hub port>"
}
Upvotes: 1