seleniumselenium-webdriverselenium-chromedriverselenium-gridselenium-grid2

Not able to execute Selenum Grid for Chrome Windows


I am using Workspaces. A glimpse of my code is as:

@BeforeMethod:
driver= gridChrome();

WebDriver gridChrome() {
System.setProperty("webdriver.chrome.driver","/absolute/path/to/chrome/driver");
DesiredCapabilities chromeCapabilities = DesiredCapabilities.chrome();
chromeCapabilities.setPlatform(Platform.WINDOWS);   
chromeCapabilities.setVersion("67.0");  
return (new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), chromeCapabilities));  
}

Workspace INFO: OS: Windows Server 2008 R2
Local IP:172.xxx.xxx.xxx

Hub: (selenium-server-jar-directory)>java -jar selenium-server-standalone-3.13.0.jar -role hub
(The IP shown is: 198.xxx.xxx.xxx)

Node: (selenium-server-jar-directory)>java -jar selenium-server-standalone-3.13.0.jar -role node -hub http://localhost:4444/grid/register

The hub and node are created effectively. The thing is, I am able to execute the same piece of code in my local system, but not in my workspaces. Also I find two different IP's. I tried creating hub and node with them too, but to no fruition.

The Exception thrown is: org.openqa.selenium.WebDriverException: Error forwarding the new session cannot find : Capabilities {browserName: chrome, platform: WINDOWS, version: 67.0}.

Another question: The function call DesiredCapabilities.setVersion(), for which parameter it sets version to, i.e Selenium Driver or Browser or Platform?

Any help would be appreciated. Thanks.


Solution

  • Try to execute this command while connecting node to hub on workspace. :
    I have tried it on AWS workspace and it is working.

    java -Dwebdriver.chrome.driver="C:\Users\jk001119\Desktop\LATEST-SET-UP-GRID\chromedriver.exe" -jar selenium-server-standalone-3.3.1.jar -role node -hub http://192.168.11.28:4444/grid/register -browser "browserName=chrome,version=56,platform=WINDOWS"
    

    For connecting with different set of browsers you can use command like this :

    java -Dwebdriver.chrome.driver="C:\Users\jk001119\Desktop\LATEST-SET-UP-GRID\chromedriver.exe" -Dwebdriver.ie.driver="C:\Users\jk001119\Desktop\LATEST-SET-UP-GRID\IEDriverServer.exe" -Dwebdriver.gecko.driver="C:\Users\jk001119\Desktop\LATEST-SET-UP-GRID\geckodriver32bit.exe" -jar selenium-server-standalone-3.3.1.jar -role node -hub http://192.168.11.28:4444/grid/register -browser "browserName=chrome,version=56,platform=WINDOWS", -browser "browserName=internet explorer,version=11,platform=WINDOWS", -browser "browserName=firefox,version=52,paltform=WINDOWS"
    

    You can remove DesiredCapabilities :

    chromeCapabilities.setPlatform(Platform.WINDOWS);
    chromeCapabilities.setVersion("67.0");

    Hope it helps you.