Reputation: 51
Below is the details where I have got exceptions as below :
When I start the node by using the below command it gives me the error like below :
F:\SeleniumGrid\Jars>java -jar selenium-server-standalone-3.0.0-beta2.jar -role webdriver -hub http://HubIpAddress:4444/grid/register -browser browserName=”firefox”, version=ANY, platform=VISTA, maxInstances=5 -Dwebdriver.gecko.driver.exe
Exception in thread “main” com.beust.jcommander.ParameterException: Was passed main parameter ‘version=ANY,’ but no main parameter was defined at com.beust.jcommander.JCommander.getMainParameter(JCommander.java:914) at com.beust.jcommander.JCommander.parseValues(JCommander.java:759) at com.beust.jcommander.JCommander.parse(JCommander.java:282) at com.beust.jcommander.JCommander.parse(JCommander.java:265) at com.beust.jcommander.JCommander.(JCommander.java:210) at org.openqa.grid.selenium.GridLauncherV3$3.setConfiguration(GridLauncherV3.java:231) at org.openqa.grid.selenium.GridLauncherV3.buildLauncher(GridLauncherV3.java:130) at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:67)
Please let me know if am done anything wrong in the above command.
Below is the java code used:
package com.test.grid;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class SelGrid {
WebDriver driver;
String baseUrl, nodeURL, hubURL;
@BeforeTest
public void setUp() throws MalformedURLException {
baseUrl = "https://www.google.co.in/";
hubURL = "http://HubIpAddress:4444/wd/hub";
DesiredCapabilities capability = DesiredCapabilities.firefox();
capability.setBrowserName("firefox");
capability.setPlatform(Platform.VISTA);
driver = new RemoteWebDriver (new URL(hubURL), capability);
}
@AfterTest
public void afterTest()
{
driver.quit();
}
@Test
public void simpleTest()
{
driver.get(baseUrl);
Assert.assertEquals("Welcome: Mercury Tours", driver.getTitle());
}
}
Upvotes: 3
Views: 6548
Reputation: 2268
Few things which might solve your issues:
From selenium 3 you have to use the geckodriver driver to be able to use firefox. You need download the geckodriver driver. Also inside your code add(inside your capabilities section):
capabilities.setCapability("marionette", true);
When you register your node to the hub use the following as is:
java -jar selenium-server-standalone-3.0.1.jar -role node -hub http://HubIpAddress:4444/grid/register -browser browserName=”firefox”, version=ANY, platform=VISTA, maxInstances=5
Upvotes: 0
Reputation: 31
You need to change the order you call the -Dwebdriver param in Selenium 3. To avoid the issue, make sure -Dwebdriver is always before the -jar call. You will need to add the hub registration and node configurations in the nodeConfig.json.
F:\SeleniumGrid\Jars>java -Dwebdriver.gecko.driver.exe -jar selenium-server-standalone-3.0.0-beta2.jar -role node -nodeConfig nodeConfig.json
Example nodeConfig
{
"capabilities":
[
{
"browserName": "firefox",
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "chrome",
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "internet explorer",
"maxInstances": 1,
"seleniumProtocol": "WebDriver"
}
],
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 5,
"port": 5555,
"register": true,
"registerCycle": 5000,
"hub": "http://localhost:4444",
"nodeStatusCheckTimeout": 5000,
"nodePolling": 5000,
"role": "node",
"unregisterIfStillDownAfter": 60000,
"downPollingLimit": 2,
"debug": false,
"servlets" : [],
"withoutServlets": [],
"custom": {}
}
Source: http://jjtheengineer.blogspot.com/2016/12/selenium-grid-30-setup-migrating-from.html
Upvotes: 3
Reputation: 831
I worked on grid multiple times and I faced the same issue with Beta version. Can you try with Selenium 2.53.1 or any other previous version.
http://learn-automation.com/selenium-grid-for-remote-execution/
Upvotes: -2