macOS: version 10.13.4
Safari: version 11.1
Selenium-standalone: version: 6.14.1
Summary: I'm getting "Cannot establish new session" in the driver logs when running automation on an instance of selenium-standalone that was started through a SSH.
Note: If you start selenium-standalone directly on the mac machine without SSH ing everything works perfectly
Steps to reproduce:
1) SSH into a mac device.
2) start selenium-standalone
command: selenium-standalone start -- -role node -nodeConfig safari.json
safari.json:
{
"capabilities":
[
{
"browserName": "safari",
"platform": "MAC",
"maxInstances": 1,
"seleniumProtocol": "WebDriver"
}
],
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 1,
"port": 5555,
"register": true,
"registerCycle": 5000,
"hub": "http://ReplaceWithHubUrl:4449",
"nodeStatusCheckTimeout": 5000,
"nodePolling": 5000,
"role": "node",
"host":"ReplacewithNodeIP",
"unregisterIfStillDownAfter": 60000,
"downPollingLimit": 2,
"debug": false,
"servlets" : [],
"withoutServlets": [],
"custom": {}
}
3) Run the automation (Of course pointed toward the hub)
selenium server logs:
12:12:41.490 INFO - Selenium build info: version: '3.8.1', revision: '6e95a6684b'
12:12:41.491 INFO - Launching a Selenium Grid node
2018-05-24 12:12:44.846:INFO::main: Logging initialized #3650ms to org.seleniumhq.jetty9.util.log.StdErrLog
12:12:44.871 INFO - Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
12:12:44.877 INFO - Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
12:12:44.879 INFO - Using `new EdgeOptions()` is preferred to `DesiredCapabilities.edge()`
12:12:44.879 INFO - Driver class not found: com.opera.core.systems.OperaDriver
12:12:44.879 INFO - Using `new OperaOptions()` is preferred to `DesiredCapabilities.operaBlink()`
12:12:44.880 INFO - Using `new SafariOptions()` is preferred to `DesiredCapabilities.safari()`
12:12:44.880 INFO - Driver class not found: org.openqa.selenium.phantomjs.PhantomJSDriver
12:12:44.890 INFO - Driver provider class org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities {browserName: internet explorer, ensureCleanSession: true, platform: WINDOWS, version: } does not match the current platform MAC
12:12:44.890 INFO - Driver provider class org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities {browserName: MicrosoftEdge, platform: WINDOWS, version: } does not match the current platform MAC
12:12:44.911 INFO - Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
12:12:44.911 INFO - Using `new EdgeOptions()` is preferred to `DesiredCapabilities.edge()`
12:12:44.911 INFO - Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
12:12:44.912 INFO - Using `new OperaOptions()` is preferred to `DesiredCapabilities.operaBlink()`
12:12:44.912 INFO - Using `new SafariOptions()` is preferred to `DesiredCapabilities.safari()`
12:12:44.917 INFO - Using the passthrough mode handler
2018-05-24 12:12:44.934:INFO:osjs.Server:main: jetty-9.4.7.v20170914
2018-05-24 12:12:44.950:WARN:osjs.SecurityHandler:main: ServletContext#o.s.j.s.ServletContextHandler#ba54932{/,null,STARTING} has uncovered http methods for path: /
2018-05-24 12:12:44.953:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler#ba54932{/,null,AVAILABLE}
2018-05-24 12:12:44.971:INFO:osjs.AbstractConnector:main: Started ServerConnector#d6e7bab{HTTP/1.1,[http/1.1]}{0.0.0.0:5555}
2018-05-24 12:12:44.971:INFO:osjs.Server:main: Started #3775ms
12:12:44.971 INFO - Selenium Grid node is up and ready to register to the hub
12:12:44.976 INFO - Starting auto registration thread. Will try to register every 5000 ms.
12:12:44.976 INFO - Registering the node to the hub: http://qa-docker02.avirat.net:4449/grid/register
12:12:44.987 INFO - The node is registered to the hub and ready to use
Selenium started
2018-05-24 12:12:49.235:INFO:osjshC.ROOT:qtp782378927-10: org.openqa.selenium.remote.server.WebDriverServlet-5e5d171f: Initialising WebDriverServlet
12:12:49.249 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.BeginSession#5452a53c
12:12:49.251 INFO - /session: Executing POST on /session (handler: BeginSession)
12:12:49.295 INFO - Capabilities are: Capabilities {browserName: safari}
12:12:49.297 INFO - Capabilities {browserName: safari} matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.safari.SafariDriverService)
Driver logs:
org.openqa.selenium.SessionNotCreatedException: Cannot establish new session
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
System info: host: 'qa01.avirat.net', ip: 'fe80:0:0:0:1854:3678:a42:3622%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.4', java.version: '1.8.0_121'
Driver info: driver.version: unknown
Command duration or timeout: 52.01 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:136)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:209)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:132)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:145)
at cucumber.driver.Factory.createDriver(Factory.java:29)
at cucumber.support.Hooks.beforeScenario(Hooks.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at cucumber.runtime.Utils$1.call(Utils.java:31)
at cucumber.runtime.Timeout.timeout(Timeout.java:16)
at cucumber.runtime.Utils.invoke(Utils.java:25)
at cucumber.runtime.java.JavaHookDefinition.execute(JavaHookDefinition.java:60)
at cucumber.runtime.HookDefinitionMatch.runStep(HookDefinitionMatch.java:17)
at cucumber.runner.UnskipableStep.executeStep(UnskipableStep.java:22)
at cucumber.api.TestStep.run(TestStep.java:83)
at cucumber.api.TestCase.run(TestCase.java:58)
at cucumber.runner.Runner.runPickle(Runner.java:80)
at cucumber.runtime.Runtime.runFeature(Runtime.java:119)
at cucumber.runtime.Runtime.run(Runtime.java:104)
at cucumber.api.cli.Main.run(Main.java:36)
at cucumber.api.cli.Main.main(Main.java:18)
Selenium Hub logs
starting selenium hub with configuration:
{
"host": null,
"port": 4444,
"role": "hub",
"maxSession": 50,
"newSessionWaitTimeout": 120000,
"capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"throwOnCapabilityNotPresent": true,
"jettyMaxThreads": -1,
"cleanUpCycle": 60000,
"browserTimeout": 60000,
"timeout": 90000,
"debug": false
}
19:33:36.875 INFO - Selenium build info: version: '3.7.1', revision: '8a0099a'
19:33:36.878 INFO - Launching Selenium Grid hub
2018-05-24 19:33:37.883:INFO::main: Logging initialized #2333ms to org.seleniumhq.jetty9.util.log.StdErrLog
19:33:37.914 INFO - Will listen on 4444
2018-05-24 19:33:38.014:INFO:osjs.Server:main: jetty-9.4.5.v20170502
2018-05-24 19:33:38.081:INFO:osjs.session:main: DefaultSessionIdManager workerName=node0
2018-05-24 19:33:38.081:INFO:osjs.session:main: No SessionScavenger set, using defaults
2018-05-24 19:33:38.089:INFO:osjs.session:main: Scavenging every 600000ms
2018-05-24 19:33:38.107:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler#57d5872c{/,null,AVAILABLE}
2018-05-24 19:33:38.154:INFO:osjs.AbstractConnector:main: Started ServerConnector#1f1c7bf6{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2018-05-24 19:33:38.155:INFO:osjs.Server:main: Started #2605ms
19:33:38.155 INFO - Nodes should register to http://10.255.1.238:4444/grid/register/
19:33:38.155 INFO - Selenium Grid hub is up and running
19:33:39.082 INFO - Registered a node http://10.57.85.10:5555
19:34:08.364 INFO - Got a request to create a new session: Capabilities {browserName: safari}
19:34:08.365 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, technologyPreview=false, se:CONFIG_UUID=c82e2553-dfdf-409c-8028-c76da8352368, browserName=safari, maxInstances=1, platform=MAC}
With High Sierra, I had to specify the specific OS version in platform, as well as the safari version as follows (in JS vs Java but same principle):
"safari": {
"browserName": "safari",
"platform": "macOS 10.13",
"version": "11.0",
"port": 4444
},
If this doesn't resolve the problem, the user you end up with on the mac you are SSHing into may not have sufficient permissions to run the driver.
Related
I am trying to run my protractor scripts on jenkins pipeline and getting the SessionNotCreatedError when it tries to access the Selenium address. When I run the same on local its working fine. Not sure what's going on.
Conf.js script
let domainName = util.domainName;
exports.config = {
seleniumAddress: 'http://selenium-hub:4444/wd/hub', //for testing in the pipeline
directConnect: false, // Set to true for local testing, or provide a link to a running selenium grid.
// specs: ['e2e/**/mailbox-test.js', 'e2e/**/email-dumps-test.js'],
specs: ['e2e/**/*-test.js'],
capabilities: {
browserName: 'chrome',
acceptInsecureCerts: true,
'goog:chromeOptions': {
w3c: false,
args: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--window-size=1200,1200',
'--disable-dev-shm-usage',
'--allow-insecure-localhost',
'--allow-running-insecure-content',
'--ignore_ssl',
'--user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36',
],
},
},
allScriptsTimeout: 600000,
baseUrl: eaUrl,
framework: 'jasmine',
jasmineNodeOpts: {
isVerbose: true,
showColors: true,
includeStackTrace: true,
defaultTimeoutInterval: 600000,
stackTrace: false
},
Jenkins output error
[15:32:21] D/launcher - Protractor version: 5.4.2 10:31:59 [15:32:21]
D/launcher - Your base url for tests is
https://ea-webapp-int-raven.ocp-nonprod.ice.dhs.gov/ 10:31:59
[15:32:21] I/launcher - Running 1 instances of WebDriver 10:31:59
[15:32:21] I/hosted - Using the selenium server at
http://selenium-hub:4444/wd/hub 10:37:05 [15:37:21] E/launcher -
Could not start a new session. New session request timed out 10:37:05
Build info: version: '4.1.2', revision: '9a5a329c5a' 10:37:05 System
info: host: 'eb3088c85a9d', ip: '172.17.0.2', os.name: 'Linux',
os.arch: 'amd64', os.version: '3.10.0-1160.53.1.el7.x86_64',
java.version: '11.0.13' 10:37:05 Driver info: driver.version: unknown
10:37:05 [15:37:21] E/launcher - SessionNotCreatedError: Could not
start a new session. New session request timed out 10:37:05 Build
info: version: '4.1.2', revision: '9a5a329c5a' 10:37:05 System info:
host: 'eb3088c85a9d', ip: '172.17.0.2', os.name: 'Linux', os.arch:
'amd64', os.version: '3.10.0-1160.53.1.el7.x86_64', java.version:
'11.0.13' 10:37:05 Driver info: driver.version: unknown 10:37:05
at Object.throwDecodedError
(/app/test/node_modules/selenium-webdriver/lib/error.js:514:15)
10:37:05 at parseHttpResponse
(/app/test/node_modules/selenium-webdriver/lib/http.js:519:13)
10:37:05 at doSend.then.response
(/app/test/node_modules/selenium-webdriver/lib/http.js:441:30)
10:37:05 at process._tickCallback
(internal/process/next_tick.js:68:7) 10:37:05 From: Task:
WebDriver.createSession() 10:37:05 at Function.createSession
(/app/test/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
10:37:05 at Function.createSession
(/app/test/node_modules/selenium-webdriver/chrome.js:761:15) 10:37:05
at createDriver
(/app/test/node_modules/selenium-webdriver/index.js:170:33) 10:37:05
at Builder.build
(/app/test/node_modules/selenium-webdriver/index.js:626:16) 10:37:05
at Hosted.getNewDriver
(/app/test/node_modules/protractor/built/driverProviders/driverProvider.js:53:33)
10:37:05 at Runner.createBrowser
(/app/test/node_modules/protractor/built/runner.js:195:43) 10:37:05
at q.then.then
(/app/test/node_modules/protractor/built/runner.js:339:29) 10:37:05
at _fulfilled (/app/test/node_modules/q/q.js:834:54) 10:37:05 at
/app/test/node_modules/q/q.js:863:30 10:37:05 at
Promise.promise.promiseDispatch (/app/test/node_modules/q/q.js:796:13)
10:37:05 [15:37:21] E/launcher - Process exited with error code 199
10:37:05 10:37:05 exitStatus=$? 10:37:05 10:37:05 # Allow the
Jenkin pipeline to access and archive any test output. 10:37:05 chmod
-R 777 ./test_output/
I am adding my observations as others might need if they get similar issues and this might help them too. After a long long investigation of the console output in Jenkins with my docker installation scripts, I noticed that we are trying to install the latest version of the selenium hub and chrome node but the docker command doesn't include the SE_EVENT_BUS_HOST information. After changing my code from
docker run -d --name selenium-node-chrome -e HUB_HOST=selenium-hub --shm-size="2g" nexus2.xxx.com:18443/selenium/node-chrome
to
docker run -d --name selenium-node-chrome -e SE_EVENT_BUS_HOST=selenium-hub --shm-size="2g" -e SE_EVENT_BUS_PUBLISH_PORT=4442 -e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 nexus2.xxx.com:18443/selenium/node-chrome
Then it started working for me.
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.
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
}
I am trying to run protractor e2e test cases on safari with windows 7. its throwing following error:
[10:27:59] I/local - Starting selenium standalone server...
[10:27:59] I/launcher - Running 1 instances of WebDriver
[10:28:00] I/local - Selenium standalone server started at http://10.1.69.133:65294/wd/hub
[10:28:01] E/launcher - The best matching driver provider org.openqa.selenium.edge.EdgeDriver can't create a new driver instance for Capabilities [{
ceptSslCerts=true, trustAllSSLCertificates=true, name=safari-tests, count=1, browserName=safari, directConnect=false, sharedTestFiles=true}]
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'DENXD7OShore41p', ip: '10.1.69.133', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_112'
Driver info: driver.version: unknown
[10:28:01] E/launcher - WebDriverError: The best matching driver provider org.openqa.selenium.edge.EdgeDriver can't create a new driver instance for
apabilities [{acceptSslCerts=true, trustAllSSLCertificates=true, name=safari-tests, count=1, browserName=safari, directConnect=false, sharedTestFile
true}]
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'DENXD7OShore41p', ip: '10.1.69.133', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_112'
Driver info: driver.version: unknown
at WebDriverError (c:\Git\operator\ui\node_modules\selenium-webdriver\lib\error.js:27:5)
at Object.checkLegacyResponse (c:\Git\operator\ui\node_modules\selenium-webdriver\lib\error.js:639:15)
at parseHttpResponse (c:\Git\operator\ui\node_modules\selenium-webdriver\http\index.js:538:13)
at client_.send.then.response (c:\Git\operator\ui\node_modules\selenium-webdriver\http\index.js:472:11)
at ManagedPromise.invokeCallback_ (c:\Git\operator\ui\node_modules\selenium-webdriver\lib\promise.js:1379:14)
at TaskQueue.execute_ (c:\Git\operator\ui\node_modules\selenium-webdriver\lib\promise.js:2913:14)
at TaskQueue.executeNext_ (c:\Git\operator\ui\node_modules\selenium-webdriver\lib\promise.js:2896:21)
at asyncRun (c:\Git\operator\ui\node_modules\selenium-webdriver\lib\promise.js:2820:25)
at c:\Git\operator\ui\node_modules\selenium-webdriver\lib\promise.js:639:7
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.createSession()
at Function.createSession (c:\Git\operator\ui\node_modules\selenium-webdriver\lib\webdriver.js:329:24)
at Builder.build (c:\Git\operator\ui\node_modules\selenium-webdriver\builder.js:458:24)
at Local.DriverProvider.getNewDriver (c:\Git\operator\ui\node_modules\protractor\built\driverProviders\driverProvider.js:37:33)
at Runner.createBrowser (c:\Git\operator\ui\node_modules\protractor\built\runner.js:198:43)
at c:\Git\operator\ui\node_modules\protractor\built\runner.js:277:30
at _fulfilled (c:\Git\operator\ui\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (c:\Git\operator\ui\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (c:\Git\operator\ui\node_modules\q\q.js:796:13)
at c:\Git\operator\ui\node_modules\q\q.js:604:44
at runSingle (c:\Git\operator\ui\node_modules\q\q.js:137:13)
[10:28:01] E/launcher - Process exited with error code 199
Here is the code for my protractor.conf.js file. I made some changes in config after error, Like i added selenium address and removed acceptSslCerts=true, trustAllSSLCertificates=true but after that i am getting the same error.
/*global jasmine */
var SpecReporter = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
browserName: 'safari',
name: 'safari-tests',
directConnect: false,
seleniumAddress: 'http://localhost:4444/wd/hub'
},
maxInstances: 1,
baseUrl: 'http://localhost:3000/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 300000,
isVerbose : true,
includeStackTrace : true,
print: function() {}
},
useAllAngular2AppRoots: true,
onPrepare: function() {
require('ts-node').register({
project: 'e2e'
});
jasmine.getEnv().addReporter(new SpecReporter());
browser.ignoreSynchronization = true;
}
};
Does it require some other configuration to run it on Safari.
Safari for Windows was discontinued years ago and installing the old Safari 5 exe that's still around won't help you achieve anything useful regarding test automation.
So never download Safari from other that the official site else chances are you are getting a Trojan in it.
You can only test Safari using a Mac OSX or you can try Sauce Labs / BrowserStack / Testing Bot / other cloud test providers to test in browsers you don't have installed locally.
I am having a real hard time setting Selenium Grid. The configuration looks like this:
Hub - windows 7 machine
Chrome on windows node - same windows 7 machine
Firefox on windows node - same windows 7 machine
ie on windows node - same windows 7 machine
Chrome on Linux node - VM running inside same windows 7 machine
Firefox on Linux node - VM running inside same windows 7 machine
Chrome on mac node - mac mini
Firefox on mac node - same mac mini
Safari on mac node - same mac mini
Web app server - VM running inside same windows 7 machine
I have a 150 tests test suite and I am trying to run all tests on all nodes in parallel. Tests run on mac mini almost never come to the end. I am getting the same error message for all three browsers and it happens without any pattern. The error might occur during any of tests. It happens even if I am running tests only in one browser on the mac mini. The problem never occurs on windows or Linux nodes.
Error message:
org.openqa.selenium.WebDriverException: cannot forward the request Connect
to 192.168.1.103:5555 [/192.168.1.103] failed: Connection timed out: connect
Command duration or timeout: 21.02 seconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'hub', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_45'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=38.0.5, platform=MAC, nativeEvents=false, acceptSslCerts=true, webdriver.remote.sessionid=1f7a9512-5c5b-4f52-bcd9-ca4d8f351343, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 1f7a9512-5c5b-4f52-bcd9-ca4d8f351343
*** Element info: {Using=xpath, value=(//*[contains(concat(' ', normalize-space(#class), ' '), ' explorerWidget ')]//*[contains(concat(' ', normalize-space(#class), ' '), ' controlContentRow ')])[2]//a}
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:422)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:352)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:449)
at org.openqa.selenium.By$ByXPath.findElement(By.java:357)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:344)
at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.openqa.selenium.support.ThreadGuard$WebDriverInvocationHandler.invokeUnderlying(ThreadGuard.java:100)
at org.openqa.selenium.support.ThreadGuard$WebDriverInvocationHandler.invoke(ThreadGuard.java:92)
at com.sun.proxy.$Proxy9.findElement(Unknown Source)
at org.openqa.selenium.support.ui.ExpectedConditions.findElement(ExpectedConditions.java:730)
at org.openqa.selenium.support.ui.ExpectedConditions.access$0(ExpectedConditions.java:728)
at org.openqa.selenium.support.ui.ExpectedConditions$3.apply(ExpectedConditions.java:106)
at org.openqa.selenium.support.ui.ExpectedConditions$3.apply(ExpectedConditions.java:1)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:208)
at com.altego.common.WebElements.getElementByXpath(WebElements.java:31)
at com.altego.webactions.View.setView(View.java:41)
at com.altego.tests.functional.DistributionViewTest.DDistributionMeasure(DistributionViewTest.java:172)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:37)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:368)
at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.openqa.grid.common.exception.GridException: cannot forward the request Connect to 192.168.1.103:5555 [/192.168.1.103] failed: Connection timed out: connect
at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:139)
at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:83)
at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.seleniumhq.jetty7.servlet.ServletHolder.handle(ServletHolder.java:565)
at org.seleniumhq.jetty7.servlet.ServletHandler.doHandle(ServletHandler.java:479)
at org.seleniumhq.jetty7.server.session.SessionHandler.doHandle(SessionHandler.java:225)
at org.seleniumhq.jetty7.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
at org.seleniumhq.jetty7.servlet.ServletHandler.doScope(ServletHandler.java:406)
at org.seleniumhq.jetty7.server.session.SessionHandler.doScope(SessionHandler.java:186)
at org.seleniumhq.jetty7.server.handler.ContextHandler.doScope(ContextHandler.java:965)
at org.seleniumhq.jetty7.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.seleniumhq.jetty7.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.seleniumhq.jetty7.server.Server.handle(Server.java:349)
at org.seleniumhq.jetty7.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
at org.seleniumhq.jetty7.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47)
at org.seleniumhq.jetty7.server.AbstractHttpConnection.content(AbstractHttpConnection.java:894)
at org.seleniumhq.jetty7.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:948)
at org.seleniumhq.jetty7.http.HttpParser.parseNext(HttpParser.java:857)
at org.seleniumhq.jetty7.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.seleniumhq.jetty7.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66)
at org.seleniumhq.jetty7.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:254)
at org.seleniumhq.jetty7.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
at org.seleniumhq.jetty7.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
at java.lang.Thread.run(Unknown Source)
I am not sure that makes much sense of putting code here since error could occur in any test, but I can leave my hubConfig.json and nodeConfig.json.
hubConfig.json
{
"host": null,
"port": 4444,
"newSessionWaitTimeout": 20000,
"servlets" : ["org.openqa.grid.web.servlets.ResourceServlet"],
"prioritizer": null,
"capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"throwOnCapabilityNotPresent": true,
"nodePolling": 5000,
"cleanUpCycle": 500000,
"timeout": 3000000,
"browserTimeout": 500000,
"maxSession": 10,
"jettyMaxThreads":-1
}
nodeConfig.json:
{
"capabilities":
[
{
"browserName": "firefox",
"maxInstances": 1
}
],
"configuration":
{
"nodeTimeout":600000,
"port":5555,
"nodePolling":5000,
"registerCycle":10000,
"register":true,
"cleanUpCycle":200000,
"timeout":600000,
"maxSession":1
}
}
Another thing that might be useful, both machines are connected to router using wireless connection.
Thanks