How to connect chrome node to selenium grid in the docker

843 views
Skip to first unread message

Vinny

unread,
Oct 24, 2021, 1:09:39 AM10/24/21
to Selenium Users

Hello there, 

I am new to Docker and my previous employee who left the company used docker image along with Nexus2 to run the selenium scripts. I got a few steps on how to install and setup the docker but on my Selenium grid I don't see webdriver and my scripts using protractor not running. Please find the scripts that I ran in my command prompt to setup. Please let me know if I missed anything that webdriver not installed

Build the image:

Docker build -t prna-tests-image -f test/Dockerfile .

Create the network:

docker network create --subnet 172.20.0.0/16 --ip-range 172.20.240.0/20 prna-network

Build the image and container for selenium hub:

docker run -d -p 4444:4444 --name selenium-hub nexus2.xxx.xxx.xxx:18443/selenium/hub:3.141.59

docker network create --subnet 172.20.0.0/16 --ip-range 172.20.240.0/20 prna-network

Connect the network to selenium hub:

docker network connect prna-network selenium-hub

Build the image and container for chrome browser:

docker run -d --name selenium-node-chrome -e HUB_HOST=selenium-hub --env HTTP_PROXY=http://proxy.dc1.xxx.xxx:80 --env HTTPS_PROXY=http://proxy.dc1.xxx.xxx:80 --env NO_PROXY=.xxx.xxx nexus2.xxx.xxx.xxx:18443/selenium/node-chrome:3.141.59

Run selenium hub and build the image and container for the tests:

docker run --rm --name prna-tests-container --network=prna-network --env RAVEN_JWT_CLIENT_ID=$RAVEN_JWT_CLIENT_ID --env RAVEN_JWT_CLIENT_PASS=$RAVEN_JWT_CLIENT_PASS --env RAVEN_OAUTH_USERNAME=$RAVEN_OAUTH_USERNAME --env RAVEN_OAUTH_TOKEN_URL=$RAVEN_OAUTH_TOKEN_URL -v "C:\prna\prna-webapp\test\test_output:/app/test/test_output" prna-tests-image

code in conf.js

"var testOutputDir =""./test_output/";
 let prnaeUrl = util.functionalTestBaseUrl("http://localhost:3000""https://prna-webapp-int-raven.ocp-nonprod.xxx.xxx.xxx/""); 
let domainName = util.domainName; 
exports.config ="{
  seleniumAddress: 'http://localhost:4444/wd/hub', //for local testing 
  directConnect: false, // Set to true for local testing, or provide a link to a running selenium grid.
 specs":[
      "e2e/**/*-test.js"
     ],
   "capabilities":{
      "browserName":"chrome",
      "acceptInsecureCerts":true,
      "goog:chromeOptions":{
         "w3c":false,
         "args":[
            "--no-sandbox",
            "--headless",
            "--disable-gpu",
            "--window-size=1200,1200",
            "--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"
         ]
      }
   }

error in console

WebDriverError: Error forwarding the new session Empty pool of VM for setup Capabilities { browserName: 'chrome', acceptInsecureCerts: true, 'goog:chromeOptions': { w3c: false, args: [ '--no-sandbox', '--headless', '--disable-gpu', '--window-size=1200,1200', '--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', ], }, }

in the selenium grid this is how it shows

j2Phm[1].png

Please help me on how to get the webdriver details shown in selenium grid?

expecting something like this

selenium_grid_14[1].png


Thanks in advance

Diego Molina

unread,
Oct 25, 2021, 7:13:55 AM10/25/21
to Selenium Users
Could you share the logs when the containers are starting?

Vinny

unread,
Oct 28, 2021, 11:54:21 PM10/28/21
to Selenium Users
Sorry, I am not sure which logs you meant. Can you please guide me where can I get those logs from.

Thanks,

⇜Krishnan Mahadevan⇝

unread,
Oct 29, 2021, 12:41:13 AM10/29/21
to Selenium Users
Vinny,

>>> Error forwarding the new session Empty pool of VM for setup Capabilities

This is Selenium's way of telling you that the hub does not have any nodes associated with it and as such your test couldn't be run.

What diego is asking for is the logs from the container, when you ran the below two docker commands


docker run -d -p 4444:4444 --name selenium-hub nexus2.xxx.xxx.xxx:18443/selenium/hub:3.141.59

docker run -d --name selenium-node-chrome -e HUB_HOST=selenium-hub --env HTTP_PROXY=http://proxy.dc1.xxx.xxx:80 --env HTTPS_PROXY=http://proxy.dc1.xxx.xxx:80 --env NO_PROXY=.xxx.xxx nexus2.xxx.xxx.xxx:18443/selenium/node-chrome:3.141.59

Because it looks like either your node container is basically crashing/failing to register itself (or) the hub for some reason is not able to reach back to the node (it does that to send heartbeats to ensure that the node is still alive) and so after 3 unsuccessful attempts the hub is perhaps de-registering the node and thus causing a hub with no nodes.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/a1afc438-a9af-4dd1-8766-130ebe830e97n%40googlegroups.com.

Vinny

unread,
Nov 3, 2021, 7:12:54 PM11/3/21
to Selenium Users

Hello,
After I remove and rerun the same commands this is what I got in the command

C:\Users\vktangut>docker run -d -p 4444:4444 --name selenium-hub nexus2.xxx.xxx.xxx:18443/selenium/hub:3.141.59
Unable to find image 'nexus2.xxx.xxx.xxx:18443/selenium/hub:3.141.59' locally
3.141.59: Pulling from selenium/hub
da7391352a9b: Already exists
14428a6d4bcd: Already exists
2c2d948710f2: Already exists
ec2bb7b8cfcf: Already exists
72c74524b7d9: Already exists
e95b037711cc: Already exists
9e29948e1cc8: Already exists
d78b0ec6f93b: Already exists
9b17ca1ca0e1: Already exists
b90dd6cf4c3a: Already exists
8c311197e57e: Pull complete
e99726f5ddbc: Pull complete
4e148d268071: Pull complete
Digest: sha256:02f251d48d5fc0957781aa16aced08b3581c1887109be8f5c754ee4d7f43248b
Status: Downloaded newer image for nexus2.xxx.xxx.xxx:18443/selenium/hub:3.141.59
23acaf5a77487a36ca26af6e3319a1ac093fa20ce820f24fde8e7ee19734b31a

C:\Users\vktangut>docker run -d --name selenium-node-chrome -e HUB_HOST=selenium-hub --env HTTP_PROXY=http://proxy.dc1.dhs.gov:80 --env HTTPS_PROXY=http://proxy.dc1.dhs.gov:80 --env NO_PROXY=.dhs.gov nexus2.xxx.xxx.xxx:18443/selenium/node-chrome:3.141.59
Unable to find image 'nexus2.xxx.xxx.xxx:18443/selenium/node-chrome:3.141.59' locally
3.141.59: Pulling from selenium/node-chrome
da7391352a9b: Already exists
14428a6d4bcd: Already exists
2c2d948710f2: Already exists
ec2bb7b8cfcf: Already exists
72c74524b7d9: Already exists
e95b037711cc: Already exists
9e29948e1cc8: Already exists
d78b0ec6f93b: Already exists
9b17ca1ca0e1: Already exists
b90dd6cf4c3a: Already exists
2c2cf0378d87: Already exists
619d6d13928d: Already exists
d6980aa31e6d: Already exists
4afbf4c86318: Already exists
09d5141a5571: Already exists
7678572f4c71: Already exists
58292a24ab09: Already exists
43fe2b7c4466: Already exists
ccc0ee5ae5ae: Already exists
17b1b93543ce: Already exists
df9057a165f3: Already exists
279323f9c697: Already exists
Digest: sha256:c51a60c3f8b100b49323a7f47df1babbd7f6df130361132102699573aed2fe82
Status: Downloaded newer image for nexus2.xxx.xxx.xxx:18443/selenium/node-chrome:3.141.59
7a4b8c01ac94d31c3b1810e344e83d889b6d3c1919170c32a45074608fc74b07

Thanks
Vinny
Reply all
Reply to author
Forward
0 new messages