Reputation: 1087
DesiredCapabilities 'Chrome' > doesn't work with 'Selenium Grid.
Current code:
case "chrome":
if (null == webdriver) {
System.setProperty("webdriver.chrome.driver", Constant.CHROME_DRIVER_DIRECTORY);
DesiredCapabilities capability = DesiredCapabilities.chrome();
capability.setBrowserName("chrome");
capability.setVersion("55.0.2883.87 m");
capability.setPlatform(Platform.WINDOWS);
webdriver = new RemoteWebDriver(new URL("http://172.16.1.48:5555/wd/hub"),capability);
}
break;
Exception: org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{browserName=chrome, version=55.0.2883.87 m, platform=WINDOWS}], required capabilities = Capabilities [{}]
Upvotes: 0
Views: 2978
Reputation: 14746
Couple of things :
DesiredCapabilities capability = DesiredCapabilities.chrome();
it automatically sets the browser name appropriately. So you don't need to set it again via capability.setBrowserName("chrome");
(So you can remove it off).capability.setVersion("55.0.2883.87 m");
because this causes your test to ask for a node that can support chrome 55
version, but if you don't specify the same versioning at your node, your grid will turn down your new session request stating it cannot find the required desired capabilities.localhost
listening to the port 4444
but your code shows as if you are trying to connect to the node directly. So please change webdriver = new RemoteWebDriver(new URL("http://172.16.1.48:5555/wd/hub"),capability);
to `webdriver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),capability);Once you have taken care of these items, your issue should get fixed.
Upvotes: 0