Hub starting command :
java -jar selenium-server-standalone-3.11.0.jar -role hub
Node starting command :
java -Dwebdriver.c
This error message...
Exception in thread "main" org.openqa.selenium.WebDriverException: Error forwarding the new session cannot find : Capabilities {browserName: chrome, platform: macOS 10.12, version: }
...implies that the ChromeDriver wasn't able to initiate an active connection with the WebClient i.e Chrome browser.
Your main issue is the version compatibility between the binaries you are using as follows :
Supports Chrome v63-65
Supports Chrome v65-67
So there is a clear mismatch between the ChromeDriver version (v2.36) and the Chrome Browser version (v66.0)
@Test
.As per your question update while working with Selenium 3.x you need to replace the keyword webdriver with node and remove the extension (.exe
) of the WebDriver variant as follows :
Mac OS X :
java -Dwebdriver.chrome.driver=/Users/alina/Selenium/chromedriver -jar selenium-server-standalone-3.11.0.jar -role node -hub http://192.168.100.4:4444/grid/register/
As you are still facing the same error let us address the error :
Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
As per the error message you need to use the merge() method from MutableCapabilities Class to merge the DesiredCapabilities type of object into ChromeOptions type object and initiate the RemoteWebDriver and WebClient instance by passing the ChromeOptions object as follows :
System.setProperty("webdriver.chrome.driver", "/Users/username/chromedriver");
nodeUrl = "http://192.168.100.4:4444/wd/hub";
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setPlatform(Platform.SIERRA);
ChromeOptions options = new ChromeOptions();
options.merge(capabilities);
driver = new RemoteWebDriver(new URL(nodeUrl), options);
driver.get("http://www.amazon.com");
PS : As a reference you can have a look at the discussions in mutablecapabilities tag