Unable to connect to a remote machine using RemoteWebdriver - selenium

As i am new to selenium WebDriver, Remote Webdriver and WebDriverManager, i have issues connecting from hub to the node. This is how my design looks like -
I have a code base which runs on linux based machines. Now, I go ahead and git clone the selenium repository on linux machine . I would want to establish that linux machine as a hub. So start the selenium Standalone server on the linux machine as below -
java -jar selenium-server-standalone-3.5.3.jar -role hub
Now i have Windows based machines which i communicate using Remote Desktop Connection application
and i consider them as nodes and on one of the windows based machine i start the selenium standalone server as a node like below -
java -jar selenium-server-standalone-3.5.3.jar -role node -hub http://<public ip of linux hub machine>:4444/grid/register/
For both i get the successful connection
Linux Machine -
Windows Machine -
I try to execute below code -
#Test
public void test() throws MalformedURLException
{
System.out.println("Sample Test");
String s1 = System.getProperty("user");
String s2 = System.getProperty("pass");
System.out.println(s1);
System.out.println(s2);
System.out.println("++++++++++++++++++SETTING UP OPTIONS+++++++++++++");
//FirefoxOptions options = new FirefoxOptions();
ChromeOptions options = new ChromeOptions();
options.addArguments("--allow-insecure-localhost");
options.addArguments("--start-maximized");
options.addArguments("--no-sandbox");
options.addArguments("--ignore-certificate-errors");
options.addArguments("--allow-running-insecure-content");
options.setAcceptInsecureCerts(true);
WebDriver driver = new RemoteWebDriver(new URL("http://<IP_LINUXMACHINE>:4444/wd/hub"),options);
System.out.println("++++++++++++++++++SETTING UP WEBDRIVER +++++++++++++++++++++++++++");
//WebDriver driver = WebDriverManager.chromedriver().capabilities(options).remoteAddress("http://<IP_LINUXMACHINE:4444/wd/hub").create();
driver.get("https://google.com");
}
Below is the MVN command -
mvn -f pom.xml -pl FrontEndTestsRepo,SharedLibrariesRepo --am clean install test -DsuiteXmlFile=testsuite.xml -Duser=abc -Dpass=abc#12
I get below error -
brotli4j not in the classpath; Brotli support will be unavailable.
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.31 sec <<< FAILURE! - in TestSuite
test(com.******.mc.tests.common.LoginTests) Time elapsed: 1.225 sec <<< FAILURE!
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: Unable to create new service: ChromeDriverService
Build info: version: '3.5.3', revision: 'a88d25fe6b', time: '2017-08-29T12:54:15.039Z'
System info: host: 'JENKINS-WIN-S12', ip: '************', os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_321'
Driver info: driver.version: unknown
Build info: version: '4.1.2', revision: '9a5a329c5a'
System info: host: 'uiUbuntu18-102-44-LinuxSlave', ip: '********', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-42-generic', java.version: '1.8.0_292'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--allow-insecure-localhost, --start-maximized, --no-sandbox, --ignore-certificate-errors, --allow-running-insecure-co...], extensions: []}}], desiredCapabilities=Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--allow-insecure-localhost, --start-maximized, --no-sandbox, --ignore-certificate-errors, --allow-running-insecure-co...], extensions: []}}}]
Capabilities {}
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:62)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
at org.openqa.selenium.remote.TracedCommandExecutor.execute(TracedCommandExecutor.java:51)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:558)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:245)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:161)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:143)
at com.*******.mc.tests.common.LoginTests.test(LoginTests.java:47)
Got below error on hub
Got a request to create a new session: Capabilities [{goog:chromeOptions={args=[--allow-insecure-localhost, --start-maximized, --no-sandbox, --ignore-certificate-errors, --allow-running-insecure-content], extensions=[]}, acceptInsecureCerts=true, browserName=chrome}]
11:48:59.308 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, browserName=chrome, maxInstances=5, platform=VISTA}

Related

Not able to run selenium test jar in ec2

I am new to selenium and by help of some blogs and videos and i made a java selenium test in eclipse which is running perfectly fine, but my goal is to run the file on an ec2. I exported the jar and tried to run it on a ubuntu VM, but it is not running and giving the error as mentioned below. Any help would be appreciated.
Microsoft Edge WebDriver was started successfully.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: chrome not reachable
Host info: host: 'ip-192-168-2-75', ip: '192.168.2.75'
Build info: version: '4.7.1', revision: 'c6795baf1a3'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-1027-aws', java.version: '11.0.17'
Driver info: org.openqa.selenium.edge.EdgeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: MicrosoftEdge, ms:edgeOptions: {args: [], extensions: []}}], desiredCapabilities=Capabilities {browserName: MicrosoftEdge, ms:edgeOptions: {args: [], extensions: []}}}]
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:148)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:106)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:551)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:159)
at org.openqa.selenium.chromium.ChromiumDriver.(ChromiumDriver.java:101)
at org.openqa.selenium.edge.EdgeDriver.(EdgeDriver.java:54)
at org.openqa.selenium.edge.EdgeDriver.(EdgeDriver.java:46)
at org.openqa.selenium.edge.EdgeDriver.(EdgeDriver.java:42)
at ui.SureSMSTest.main(SureSMSTest.java:36)

SeleniumGrid : org.openqa.selenium.SessionNotCreatedException: Unable to create new service: ChromeDriverService Build info: version: '3.141.59'

Thats how I started : Hub command : java -jar selenium-server-standalone-3.141.59.jar -role hub
Node Command : java -Dwebdriver.chrome.driver="\Users\rachitamittal\eclipse-workspace\firstjavaproject\drivers\chromedriver.exe" -jar selenium-server-standalone-3.141.59.jar -role node -port 5556 -hub "http://localhost:4444/wd/hub" -browser browserName=chrome,maxInstances=3
I have first only created a single node.
MY program :
#Test
public void remotetester() throws MalformedURLException
{
DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setBrowserName("chrome");
cap.setPlatform(Platform.MAC);
RemoteWebDriver driver=new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),cap);
driver.get("https://www.google.com/");
driver.manage().window().maximize();
driver.close();
}
Error :
org.openqa.selenium.SessionNotCreatedException: Unable to create new service: ChromeDriverService
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: '///////////', ip: '/////////////////', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.4', java.version: '14.0.1'
Hope so you are doing great and you are safe. The problem is the webdriver path is incorrect. I believe that you have missed to method drive i.e C: in your web driver path.
If you are new and do not know how to configure the selenium grid in the local system then you can use the below utility for the automatic configuration.
https://github.com/frostyaxe/Talongrid

Firefox not working with selenium grid

I want to execute the parallel test with multiple Firefox browsers configured in multiple machines.
Thanks in advance.
Firefox Version: 60.0.1
Selenium Firefox Driver: 3.7.1
Geckdriver Version: v0.19.0
When I trigger Firefox (not parallel), it is working fine. JAVA Code below:
System.setProperty("webdriver.gecko.driver","C:\\Fm2\\Try_Browsers\\Browsers\\drivers\\geckodriver_19.exe");
WebDriver driver = new FirefoxDriver();
driver.get("https://www.google.com/");
driver.close();
Code/setup for Parallel browsing I did this, and its NOT working
I have setup grid and node in the different bat files:
HUb setup:
java -jar selenium-server-standalone-3.1.0.jar -port 4444 -role hub
Node Setup:
java -Dwebdriver.gecko.driver=./geckodriver_19.exe -jar selenium-server-standalone-3.1.0.jar -port 5557 -role node -hub http://localhost:4444/grid/register -browser "browserName=firefox, maxInstances=10, platform=ANY, seleniumProtocol=WebDriver"
JAVA Code for executing Firefox using remote driver
System.setProperty("webdriver.gecko.driver","C:\\Fm2\\Try_Browsers\\Browsers\\drivers\\geckodriver.exe");
DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setBrowserName("firefox");
cap.setPlatform(Platform.ANY);
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), cap);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get("https://www.google.com/");
driver.close();
Error in Eclipse console:
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{acceptInsecureCerts=true, browserName=firefox, moz:firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions#21fa0ed7, version=, platform=ANY, firefox_profile=org.openqa.selenium.firefox.FirefoxProfile#49991a02}], required capabilities = Capabilities [{}]
Build info: version: '3.1.0', revision: '86a5d70', time: '2017-02-16 07:57:44 -0800'
System info: host: 'LAPTOP-9JJJC37G', ip: '192.168.100.205', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_151'
Driver info: driver.version: FirefoxDriver
Command duration or timeout: 9.72 seconds
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:155)
at Browsers.callBrowsers.sFireFox(callBrowsers.java:45)
at Browsers.callBrowsers.main(callBrowsers.java:27)
Error in Node log
18:16:02.462 INFO - Executing: [new session: Capabilities [{acceptInsecureCerts=true, browserName=firefox, version=, platform=ANY}]])
18:16:02.488 INFO - Creating a new session for Capabilities [{acceptInsecureCerts=true, browserName=firefox, version=, platform=ANY}]
1531124162793 geckodriver INFO geckodriver 0.19.1
1531124162811 geckodriver INFO Listening on 127.0.0.1:13887
1531124163451 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-profile" "C:\\Users\\Viki\\AppData\\Local\\Temp\\rust_mozprofile.TtfJrIS5pIAk"
Unable to read VR Path Registry from C:\Users\Viki\AppData\Local\openvr\openvrpaths.vrpath
Unable to read VR Path Registry from C:\Users\Viki\AppData\Local\openvr\openvrpaths.vrpath
Unable to read VR Path Registry from C:\Users\Viki\AppData\Local\openvr\openvrpaths.vrpath
Unable to read VR Path Registry from C:\Users\Viki\AppData\Local\openvr\openvrpaths.vrpath
Unable to read VR Path Registry from C:\Users\Viki\AppData\Local\openvr\openvrpaths.vrpath
1531124171024 Marionette INFO Listening on port 50055
18:16:11.966 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '3.1.0', revision: '86a5d70', time: '2017-02-16 07:57:44 -0800'
System info: host: 'LAPTOP-9XXXC39G', ip: '122.148.110.105', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_151'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:183)
at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:119)
at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:95)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:131)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:59)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:36)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:111)
at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:189)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:222)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:184)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:150)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:808)
at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:587)
at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.seleniumhq.jetty9.server.Server.handle(Server.java:499)
at org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:310)
at org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.seleniumhq.jetty9.io.AbstractConnection$2.run(AbstractConnection.java:540)
at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:748)
I see several things that could lead to your mistake. First, the version 3.1.0 is very old you should rather use 3.14.0, also the geckodriver is already with version 0.21.0.
For der latest Realeses look at here: seleniumhq
Secound, you should use the FirefoxOptions as a transfer parameter for the RemoteDriver(UrlToHub,FirefoxOptions) and merge your DesiredCapabilities into the FirefoxOptions beforehand.
And as last problem I see, you use http://localhost:4444/wd/hub as url. When you start the hub you will see a URL to register in the console which is not in your IP pool, you should also use this.
To start the hub you only need the commandline command:cd pathToSeleniumStandAloneServerFolder and the start command is: java -jar selenium-standalone-<version>.jar -role hub the port "4444" is default
Then you will see the right URL to connect the RemoteWebDriver(). It´s look like this:
c:usr\Downloads>java -jar "selenium-server-standalone-3.14.0.jar" -role hub
12:56:40.723 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.14.0', revision: 'aacccce0'
12:56:40.725 INFO [GridLauncherV3$2.launch] - Launching Selenium Grid hub on port 4444
2018-09-07 12:56:41.063:INFO::main: Logging initialized #588ms to org.seleniumhq.jetty9.util.log.StdErrLog
12:56:41.447 INFO [Hub.start] - Selenium Grid hub is up and running
12:56:41.448 INFO [Hub.start] - Nodes should register to http://192.168.56.1:4444/grid/register/
12:56:41.448 INFO [Hub.start] - Clients should connect to http://192.168.56.1:4444/wd/hub
The last row is the connectable URL for the RemoteWebDriver()
Now let's start the NODE with:
java -Dwebdriver.gecko.driver="PathToYourFirefoxDriver" -jar selenium-standalone-server-<versio>.jar -role node -hub http:UrlToHub:port/grid/register
Look at this example:
public WebDriver getWebDriver(final DesiredCapabilities desiredCapabilities) {
FirefoxOptions firefoxOptions;
DesiredCapabilities capabilities = new DesiredCapabilities()
capabilities.merge(desiredCapabilities);
capabilities.setPlatform(Platform.ANY);
capabilities.setBrowserName("firefox");
firefoxOptionHelper.merge(capabilities);
try {
WebDriver webDriver = new RemoteWebDriver(new URL(this.gridHubUrl), firefoxOptions);
return webDriver;
} catch (MalformedURLException e) {
e.printStackTrace();
}
return null;
}
Hopefully it helps.

Getting "org.openqa.selenium.WebDriverException: Error forwarding the new session Error forwarding the request Connect to" connecting hub with node

OS: Linux
Selenium Version:**3.12
**Browser: Chrome V66,
chromedriver 2.38
Following is my Grid configuration:
Hub(Linux) runs on Jenkins machine(https://jenkins.us.abc.edu) with Selenium Grid Jenkins plugin.
Now i am trying to register my Node with json like below and starting Node:
java -jar -Dwebdriver.chrome.driver=chromedriver selenium-rver-standalone-3.12.0.jar -role node -nodeConfig node.json
node.json
{
"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": 17946,**
"register": true,
"registerCycle": 5000,
**"hub": "http://jenkins.us.abc.edu:4444",**
"nodeStatusCheckTimeout": 5000,
"nodePolling": 5000,
"role": "node",
"unregisterIfStillDownAfter": 60000,
"downPollingLimit": 2,
"debug": false,
"servlets" : [],
"withoutServlets": [],
"custom": {}
}
Following is Node console:
[uanem#usv-selapp-01 ~]$ java -jar -Dwebdriver.chrome.driver=chromedriver selenium-rver-standalone-3.12.0.jar -role node -nodeConfig node.json
09:37:49.054 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.12.0', revision: '7c6e0b3'
09:37:49.059 INFO [GridLauncherV3$3.launch] - Launching a Selenium Grid node on port 17946
2018-05-28 09:37:49.175:INFO::main: Logging initialized #490ms to org.seleniumhq.jetty9.util.log.StdErrLog
09:37:49.324 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 17946
09:37:49.324 INFO [GridLauncherV3$3.launch] - Selenium Grid node is up and ready to register to the hub
09:37:49.332 INFO [SelfRegisteringRemote$1.run] - Starting auto registration thread. Will try to register every 5000 ms.
09:37:49.332 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://jenkins.us.umuc.edu:4444/grid/register
09:37:50.866 INFO [SelfRegisteringRemote.registerToHub] - Updating the node configuration from the hub
09:37:50.965 WARN [SelfRegisteringRemote.registerToHub] - error getting the parameters from the hub. The node may end up with wrong timeouts.hudson.plugins.selenium.JenkinsCapabilityMatcher could not be coerced to instance
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
System info: host: 'usv-selapp-01.us.umuc.edu', ip: '10.190.33.90', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-862.el7.x86_64', java.version: '1.8.0_144'
Driver info: driver.version: unknown
09:37:50.965 INFO [SelfRegisteringRemote.registerToHub] - The node is registered to the hub and ready to use
09:39:11.333 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://jenkins.us.umuc.edu:4444/grid/register
09:39:11.392 INFO [SelfRegisteringRemote.registerToHub] - Updating the node configuration from the hub
09:39:11.404 WARN [SelfRegisteringRemote.registerToHub] - error getting the parameters from the hub. The node may end up with wrong timeouts.hudson.plugins.selenium.JenkinsCapabilityMatcher could not be coerced to instance
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
System info: host: 'usv-selapp-01.us.umuc.edu', ip: '10.190.33.90', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-862.el7.x86_64', java.version: '1.8.0_144'
Driver info: driver.version: unknown
09:39:11.405 INFO [SelfRegisteringRemote.registerToHub] - The node is registered to the hub and ready to use
09:40:31.602 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://jenkins.us.umuc.edu:4444/grid/register
09:40:31.632 INFO [SelfRegisteringRemote.registerToHub] - Updating the node configuration from the hub
09:40:31.642 WARN [SelfRegisteringRemote.registerToHub] - error getting the parameters from the hub. The node may end up with wrong timeouts.hudson.plugins.selenium.JenkinsCapabilityMatcher could not be coerced to instance
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
System info: host: 'usv-selapp-01.us.umuc.edu', ip: '10.190.33.90', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-862.el7.x86_64', java.version: '1.8.0_144'
Driver info: driver.version: unknown
09:40:31.642 INFO [SelfRegisteringRemote.registerToHub] - The node is registered to the hub and ready to use
09:41:51.809 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://jenkins.us.umuc.edu:4444/grid/register
09:41:51.850 INFO [SelfRegisteringRemote.registerToHub] - Updating the node configuration from the hub
09:41:51.856 WARN [SelfRegisteringRemote.registerToHub] - error getting the parameters from the hub. The node may end up with wrong timeouts.hudson.plugins.selenium.JenkinsCapabilityMatcher could not be coerced to instance
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
System info: host: 'usv-selapp-01.us.umuc.edu', ip: '10.190.33.90', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-862.el7.x86_64', java.version: '1.8.0_144'
Driver info: driver.version: unknown
09:41:51.856 INFO [SelfRegisteringRemote.registerToHub] - The node is registered to the hub and ready to use
Here i could see the node is connected hub in my Jenkins Selenium Grid page at "10.190.33.90"
Following is my sample script:
#Test
public void GoogleTest() throws Exception
{
System.out.println("I am in test");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
System.out.println("I am after setting chromedriver path ");
**remoteWD = new RemoteWebDriver(new URL("http://usv-bmsapp-01.us.abc.edu:4444/wd/hub"), capabilities);**
**//remoteWD = new RemoteWebDriver(new URL("https://jenkins.us.abc.edu:4444/wd/hub"), capabilities);**
//remoteWD = new ChromeDriver();
System.out.println("I am after RMD");
remoteWD.get("http://www.google.com");
WebElement element = remoteWD.findElement(By.name("q"));
element.sendKeys("Selenium WebDriver");
element.submit();
Thread.sleep(10000);
System.out.println(remoteWD.getTitle());
remoteWD.quit();
}
Due to security reasons or whatever i am not able to connect "https://jenkins.us.abc.edu:4444/wd/hub", but when i give the server name like this "http://usv-bmsapp-01.us.abc.edu:4444/wd/hub" I am able to connect.
Following is the error message i am getting. Can someone help me where i am going wrong???
Running gridtest.GridTest
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator#7dc5e7b4
I am before test
I am in test
I am after setting chromedriver path
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 95.6 sec <<< FAILURE!
GoogleTest(gridtest.GridTest) Time elapsed: 94.334 sec <<< FAILURE!
org.openqa.selenium.WebDriverException: Error forwarding the new session Error forwarding the request Connect to 10.190.33.90:17946 [/10.190.33.90] failed: Connection timed out
Command duration or timeout: 92.06 seconds
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$24(ProtocolHandshake.java:359)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:362)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:586)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:217)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:140)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:153)
at gridtest.GridTest.GoogleTest(GridTest.java:49)
Caused by: org.openqa.selenium.WebDriverException: Error forwarding the new session Error forwarding the request Connect to 10.190.33.90:17946 [/10.190.33.90] failed: Connection timed out
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
System info: host: 'usv-bmsapp-01.us.umuc.edu', ip: '10.190.32.186', os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-696.23.1.el6.x86_64', java.version: '1.8.0_77'
Driver info: driver.version: unknown
at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:117)
at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:84)
at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:841)
at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:535)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.seleniumhq.jetty9.server.Server.handle(Server.java:564)
at org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:317)
at org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:251)
at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.seleniumhq.jetty9.io.FillInterest.fillable(FillInterest.java:110)
at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at org.seleniumhq.jetty9.util.thread.Invocable.invokePreferred(Invocable.java:128)
at org.seleniumhq.jetty9.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222)
at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294)
at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:199)
at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
at java.lang.Thread.run(Thread.java:745)
There seems to be a couple of issues which you ned to address as follows:
Selenium version
Logs in Node depicts:
Selenium version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
Logs in Console depicts:
Selenium version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
JDK version
Logs in Node depicts:
java.version '1.8.0_144'
Logs in Console depicts:
java.version '1.8.0_77'
Node startup command
The command which you have used to register the node looks error-pront as follows:
java -jar -Dwebdriver.chrome.driver=chromedriver selenium-rver-standalone-3.12.0.jar -role node -nodeConfig node.json
It should have been:
java -jar -Dwebdriver.chrome.driver=chromedriver selenium-server-standalone-3.12.0.jar -role node -nodeConfig node.json
Solution
Upgrade JDK in Selenium Grid Hub and Selenium Grid Node to recent levels JDK 8u171.
Upgrade Selenium Client in Selenium Grid Hub and _Selenium Grid Node_to current levels Version 3.12.0.
Upgrade ChromeDriver to current ChromeDriver v2.38 level.
Keep Chrome version at Chrome v66.x levels. (as per ChromeDriver v2.38 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
nodeConfig
To start simple you can reduce the nodeConfig i.e. node.json as follows:
{
"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": 5566,
"host": ip,
"register": true,
"registerCycle": 5000,
"hubPort": 4444,
"hubHost": jenkins.us.abc.edu,
"timeout":120,
"browserTimeout":60
}

Unable to launch firefox with selenium grid 3.0.1 gecko driver 0.11.1 firefox 50.0.1

Trying to launch firefox with selenium grid is through exception as below:
org.openqa.selenium.sessionnotcreatedexception
Code I am using is as below:
if(useRemoteWebDriver){
URL seleniumGridURL = new URL(System.getProperty("gridURL"));
String desiredBrowserVersion = System.getProperty("desiredBrowserVersion");
String desiredPlatform = System.getProperty("desiredPlatform");
if (!desiredPlatform.isEmpty())
if ((null != desiredPlatform)) {
desiredCapabilities.setPlatform(Platform.valueOf(desiredPlatform.toUpperCase()));
}
if (null != desiredBrowserVersion && !desiredBrowserVersion.isEmpty()){
desiredCapabilities.setVersion(desiredBrowserVersion);
}
webDriver = new RemoteWebDriver(seleniumGridURL, desiredCapabilities);
}else{
webDriver = selectedDriverType.getWebDriverObject(desiredCapabilities);
}
and I am trying to run it from command line using
mvn clean install -Dremote=true -DseleniumGridURL=http://localhost:5555/wd/hub -Dbrowser=firefox -Dwebdriver.gecko.driver="E:\GeckoDriver\geckodriver.exe" -DbrowserVersion="50.0.1"
this is giving me the following exception
org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, binary=C:\Program Files (x86)\Mozilla Firefox\firefox.exe, browserName=firefox, version=50.0.1, platform=ANY}], required capabilities = Capabilities [{}]
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'exipc0006', ip: '172.16.12.123', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_111'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:91)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:155)
at com.HomLuvAutomation.WebDriverThread.instantiateWebDriver(WebDriverThread.java:89)
at com.HomLuvAutomation.WebDriverThread.getDriver(WebDriverThread.java:40)
at com.HomLuvAutomation.DriverFactory.getDriver(DriverFactory.java:46)
at com.HomLuvAutomation.BasicSearchWD.exampleOfTestNgMaven(BasicSearchWD.java:22)
at com.HomLuvAutomation.BasicSearchWD.austinSearch(BasicSearchWD.java:56)