Server runs fine: getting response in the Chrome when navigated to the http://localhost:4444/wd/hub
However when trying to run conf.js:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['integration/buildingCodes/buildingCodesTest.js']
}
getting the exception below:
node_modules\protractor\bin>node protractor
std\winplatform\platform8\engineandcloudtrunk\Axon\Axon.Portal\UnitTests\conf.j
s
Using the selenium server at http://localhost:4444/wd/hub
node_modules\protractor\node_modules\selenium-webdriver\lib\at
oms\error.js:109
var template = new Error(this.message);
^
UnknownError: Error forwarding the new session Empty pool of VM for setup Capabi
lities [{count=1, browserName=chrome}]
at new bot.Error (node_modules\protractor\node_modules\sel
enium-webdriver\lib\atoms\error.js:109:18)
at Object.bot.response.checkResponse (node_modules\protrac
tor\node_modules\selenium-webdriver\lib\atoms\response.js:106:9)
at node_modules\protractor\node_modules\selenium-webdriver
\lib\webdriver\webdriver.js:134:24
at node_modules\protractor\node_modules\selenium-webdriver
\lib\goog\base.js:1243:15
at webdriver.promise.ControlFlow.runInNewFrame_ (node_modu
les\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1539:20)
at notify (node_modules\protractor\node_modules\selenium-w
ebdriver\lib\webdriver\promise.js:362:12)
at notifyAll (node_modules\protractor\node_modules\seleniu
m-webdriver\lib\webdriver\promise.js:331:7)
at resolve (node_modules\protractor\node_modules\selenium-
webdriver\lib\webdriver\promise.js:309:7)
at fulfill (node_modules\protractor\node_modules\selenium-
webdriver\lib\webdriver\promise.js:429:5)
at node_modules\protractor\node_modules\selenium-webdriver
\lib\goog\base.js:1243:15
==== async task ====
WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (node_modu
les\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:131:49
)
at Function.webdriver.WebDriver.createSession (node_module
s\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:111:30)
at Builder.build (node_modules\protractor\node_modules\sel
enium-webdriver\builder.js:106:20)
at HostedDriverProvider.getDriver (node_modules\protractor
\lib\driverProviders\hosted.js:54:9)
at node_modules\protractor\lib\runner.js:221:35
at _fulfilled (node_modules\protractor\node_modules\q\q.js
:797:54)
at self.promiseDispatch.done (node_modules\protractor\node
_modules\q\q.js:826:30)
at Promise.promise.promiseDispatch (node_modules\protracto
r\node_modules\q\q.js:759:13)
at node_modules\protractor\node_modules\q\q.js:525:49
Interesting - this is the Selenium Server throwing an error when trying to start a new session - can you start a new session manually from the info page at http://localhost:4444/wd/hub?
Yes, I'm able to navigate to the http://localhost:4444/wd/hub and see the JSON ouput (if that's what you mean.)
No, I mean can you start a new session from http://localhost:4444/wd/hub (click on the "Create Session" button).
When I navigate to the http://localhost:4444/wd/hub there is no buttons: all I see is the JSON output with the java.lang.NullPointerException. Here is the full stack:
{"status":13,"value":{"class":"java.lang.NullPointerException","stackTrace":[{"fileName":"ExternalSessionKey.java","lineNumber":75,"className":"org.openqa.grid.internal.ExternalSessionKey","methodName":"fromWebDriverRequest"},{"fileName":"WebDriverRequest.java","lineNumber":60,"className":"org.openqa.grid.web.servlet.handler.WebDriverRequest","methodName":"extractSession"},{"fileName":"RequestHandler.java","lineNumber":237,"className":"org.openqa.grid.web.servlet.handler.RequestHandler","methodName":"getSession"},{"fileName":"RequestHandler.java","lineNumber":119,"className":"org.openqa.grid.web.servlet.handler.RequestHandler","methodName":"process"},{"fileName":"DriverServlet.java","lineNumber":83,"className":"org.openqa.grid.web.servlet.DriverServlet","methodName":"process"},{"fileName":"DriverServlet.java","lineNumber":61,"className":"org.openqa.grid.web.servlet.DriverServlet","methodName":"doGet"},{"fileName":"HttpServlet.java","lineNumber":707,"className":"javax.servlet.http.HttpServlet","methodName":"service"},{"fileName":"HttpServlet.java","lineNumber":820,"className":"javax.servlet.http.HttpServlet","methodName":"service"},{"fileName":"ServletHolder.java","lineNumber":565,"className":"org.seleniumhq.jetty7.servlet.ServletHolder","methodName":"handle"},{"fileName":"ServletHandler.java","lineNumber":479,"className":"org.seleniumhq.jetty7.servlet.ServletHandler","methodName":"doHandle"},{"fileName":"SessionHandler.java","lineNumber":225,"className":"org.seleniumhq.jetty7.server.session.SessionHandler","methodName":"doHandle"},{"fileName":"ContextHandler.java","lineNumber":1031,"className":"org.seleniumhq.jetty7.server.handler.ContextHandler","methodName":"doHandle"},{"fileName":"ServletHandler.java","lineNumber":406,"className":"org.seleniumhq.jetty7.servlet.ServletHandler","methodName":"doScope"},{"fileName":"SessionHandler.java","lineNumber":186,"className":"org.seleniumhq.jetty7.server.session.SessionHandler","methodName":"doScope"},{"fileName":"ContextHandler.java","lineNumber":965,"className":"org.seleniumhq.jetty7.server.handler.ContextHandler","methodName":"doScope"},{"fileName":"ScopedHandler.java","lineNumber":117,"className":"org.seleniumhq.jetty7.server.handler.ScopedHandler","methodName":"handle"},{"fileName":"HandlerWrapper.java","lineNumber":111,"className":"org.seleniumhq.jetty7.server.handler.HandlerWrapper","methodName":"handle"},{"fileName":"Server.java","lineNumber":349,"className":"org.seleniumhq.jetty7.server.Server","methodName":"handle"},{"fileName":"AbstractHttpConnection.java","lineNumber":452,"className":"org.seleniumhq.jetty7.server.AbstractHttpConnection","methodName":"handleRequest"},{"fileName":"BlockingHttpConnection.java","lineNumber":47,"className":"org.seleniumhq.jetty7.server.BlockingHttpConnection","methodName":"handleRequest"},{"fileName":"AbstractHttpConnection.java","lineNumber":884,"className":"org.seleniumhq.jetty7.server.AbstractHttpConnection","methodName":"headerComplete"},{"fileName":"AbstractHttpConnection.java","lineNumber":938,"className":"org.seleniumhq.jetty7.server.AbstractHttpConnection$RequestHandler","methodName":"headerComplete"},{"fileName":"HttpParser.java","lineNumber":634,"className":"org.seleniumhq.jetty7.http.HttpParser","methodName":"parseNext"},{"fileName":"HttpParser.java","lineNumber":230,"className":"org.seleniumhq.jetty7.http.HttpParser","methodName":"parseAvailable"},{"fileName":"BlockingHttpConnection.java","lineNumber":66,"className":"org.seleniumhq.jetty7.server.BlockingHttpConnection","methodName":"handle"},{"fileName":"SocketConnector.java","lineNumber":254,"className":"org.seleniumhq.jetty7.server.bio.SocketConnector$ConnectorEndPoint","methodName":"run"},{"fileName":"QueuedThreadPool.java","lineNumber":599,"className":"org.seleniumhq.jetty7.util.thread.QueuedThreadPool","methodName":"runJob"},{"fileName":"QueuedThreadPool.java","lineNumber":534,"className":"org.seleniumhq.jetty7.util.thread.QueuedThreadPool$3","methodName":"run"},{"fileName":"Thread.java","lineNumber":724,"className":"java.lang.Thread","methodName":"run"}]}}
whelp that's not good. Your selenium server is not being started up correctly.
Can you try re-downloading and starting it again?
Due to restrictions I'm unable to run the webdriver-manager update and have to set up and run the chromedriver.exe/selenium-server-standalone-2.41.0.jar manually (using java -jar selenium-server-standalone-2.41.0.jar -role hub -port 4444.) Altogether it produces the issue that I specified above.
Ah! You don't want that -role hub part. Get rid of it and try again.
That did the trick! Thanks.
I managed to create and run a test.
Now, there is an issue with the debugger: when I try to start the protractor in the debug mode: protractor debug conf.js
it gets stuck in the console:
Starting debugger agent.
debugger listening on port 5858
Using the selenium server at http://127.0.0.1:4444/wd/hub
connecting... ok
break in timers.js:77
75 }
76
77 function listOnTimeout() {
78 var msecs = this.msecs;
79 var list = this;
debug>
Do I have to open another issue for that or there is a quick solution?
That's working as intended. It's debugging. You need to press 'c' to continue.
Hi juliemr
What is the difference when we use -role hub in command line? I have the same problem and when I get rid of -role hub it works as you told. When I see http://localhost:4444/wd/hub I get the following :
"message": "Session [(null externalkey)] not available and is not among the last 1000 terminated sessions.\nActive sessions are[]",
"class": "org.openqa.grid.common.exception.GridException",
"stackTrace": [
{
"fileName": "ActiveTestSessions.java",
"className": "org.openqa.grid.internal.ActiveTestSessions",
"methodName": "getExistingSession",
"lineNumber": 110
},
@oraclemohammadi did you find answer to your question? Can some one please answer the question.
What is the difference when we use -role hub in command line? And if we use -role hub, how can we get it working?
After some more investigation, i found this info.
That exception "Error forwarding the new session Empty pool of VM" means that your Selenium Grid doesn't have any node available with a browser that has the desired capabilities.
If you're running Selenium Grid as a hub on your machine (-role hub) make sure that at least one node which provides the desired browser is connected to that hub. Check out http://localhost:4444/grid/console to see whether any nodes are connected to your hub.
I am getting same above error when running Selenium Grid from Jenkins. As i am running from Jenkins with Selenium plugin, i am not using -role hub. How to overcome this error here?
#!/bin/sh -e
# idea stolen from https://gist.github.com/nicerobot/1136dcfba6ce3da67ce3ded5101a4078
# USAGE
# /bin/wait-chrome-connected-to-hub http://$HUB_HOST:$HUB_PORT
hub_url="$1"
# Retries a command on failure (idea stolen from http://fahdshariff.blogspot.com/2014/02/retrying-commands-in-shell-scripts.html).
# $1 - the max number of attempts
# $2 - the seconds to sleep
# $3... - the command to run
retry() {
max_attempts="$1"; shift
seconds="$1"; shift
cmd="$@"
attempt_num=1
until $cmd
do
if [ $attempt_num -eq $max_attempts ]
then
echo "Attempt $attempt_num failed and there are no more attempts left!"
return 1
else
echo "Attempt $attempt_num failed! Trying again in $seconds seconds..."
attempt_num=`expr "$attempt_num" + 1`
sleep "$seconds"
fi
done
}
check_connected () {
curl --silent --fail --connect-timeout 40 $hub_url/grid/console | grep "browserName: chrome" > /dev/null
}
retry 5 1 check_connected
echo >&2 "$(date +%Y%m%dt%H%M%S) Chrome is conneted to hub"
hub:
image: elgalu/selenium
volumes:
- /dev/shm:/dev/shm
privileged: true
environment:
- SELENIUM_HUB_HOST=hub
- SELENIUM_HUB_PORT=4444
- GRID=true
- CHROME=false
- FIREFOX=false
- NOVNC=false
- VNC_START=false
chrome:
image: elgalu/selenium
privileged: true
environment:
- SELENIUM_HUB_HOST=hub
- SELENIUM_HUB_PORT=4444
- SCREEN_WIDTH=1880
- SCREEN_HEIGHT=1040
- VIDEO=false
- GRID=false
- CHROME=true
- FIREFOX=false
- CHROME_ADDITIONAL_ARGS=--ignore-certificate-errors
# - SELENIUM_NODE_HOST={{CONTAINER_IP}} # not working
- SELENIUM_NODE_HOST=0.0.0.0
volumes:
- downloads:/downloads
- /dev/shm:/dev/shm
- ../../fixtures:/fixtures:ro
feature_tests:
image: node....
command: |
sh -c "
/bin/waitforit -host=$$CLIENT_HOST -port=$$CLIENT_PORT -timeout=30 &&
/bin/waitforit -host=$$HUB_HOST -port=$$HUB_PORT -timeout=30 &&
/bin/waitforit -host=$$MAILHOG_HOST -port=$$MAILHOG_PORT -timeout=30 &&
/bin/waitforit -host=$$POSTGRES_HOST -port=$$POSTGRES_PORT -timeout=20 &&
/bin/wait-chrome-connected-to-hub http://$$HUB_HOST:$$HUB_PORT &&
(curl --silent --fail --connect-timeout 40 $$CLIENT_URL > /dev/null) &&
exec npm run test"
volumes:
- ../../scripts/waitforit:/bin/waitforit:ro
- ../../scripts/wait-chrome-connected-to-hub:/bin/wait-chrome-connected-to-hub:ro
environment:
CLIENT_HOST: client
CLIENT_PORT: 3000
CLIENT_URL: http://client:3000
HUB_URL: http://hub:4444/wd/hub
HUB_HOST: hub
HUB_PORT: 4444
POSTGRES_USER: app_admin
POSTGRES_PASSWORD: app_admin_pass
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_DB: gb_test
MAILHOG_URL: http://mailhog:8025
MAILHOG_HOST: mailhog
MAILHOG_PORT: 8025
Most helpful comment
Ah! You don't want that
-role hubpart. Get rid of it and try again.