Selenium: Unable to run GhostDriver(phantomJS) node on Docker Selenium Grid Setup

I am trying to run my automation scripts using Selenium Grid setup and the docker images found at: https://github.com/SeleniumHQ/docker-selenium.

I am able to get the Docker Selenium Hub and ready to go. This is what it looks like on my Grid Console after starting the Hub and spawning 4 GhostDriver nodes: Selenium Grid Setup through Docker
Now running my tests after pointing them to the new hub time out when trying to hit any of my company’s internal sites (eg. http://test.domain.com) but not if I point my tests to run against http://www.google.com for example. That being said it seems like the obvious reason is an issue with Docker using some DNS that it isn’t supposed to, but that is not the case. I’ve verified the DNS the docker containers are pointed to by verifying the resolv.conf is pointing to a valid DNS entry (not 8.8.8.8 or something like that). Also I am able to ping and curl internal URLs fine, so it seems like the Docker containers should be able to hit the internal URLs.

  • docker-compose yml running a script after up
  • Set values on image build for a Docker container
  • Docker, how to deal with ssh keys, known_hosts and authorized_keys
  • Problems getting docker containers to see (ping) each other by name
  • How to build and run a java instance in Docker
  • boot2docker vm forgets changes when restarted
  • Here is the log output from the Selenium Hub:

     20:49:09.649 INFO - Selenium build info: version: '3.4.0', revision: 'unknown'
    20:49:09.650 INFO - Launching Selenium Grid hub
    2017-06-08 20:49:10.221:INFO::main: Logging initialized @949ms to org.seleniumhq.jetty9.util.log.StdErrLog
    20:49:10.239 INFO - Will listen on 4444
    2017-06-08 20:49:10.297:INFO:osjs.Server:main: jetty-9.4.3.v20170317
    2017-06-08 20:49:10.336:INFO:osjs.session:main: DefaultSessionIdManager workerName=node0
    2017-06-08 20:49:10.336:INFO:osjs.session:main: No SessionScavenger set, using defaults
    2017-06-08 20:49:10.340:INFO:osjs.session:main: Scavenging every 600000ms
    2017-06-08 20:49:10.348:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@5d47c63f{/,null,AVAILABLE}
    2017-06-08 20:49:10.369:INFO:osjs.AbstractConnector:main: Started ServerConnector@5ef60048{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
    2017-06-08 20:49:10.370:INFO:osjs.Server:main: Started @1098ms
    20:49:10.370 INFO - Nodes should register to http://12.12.0.2:4444/grid/register/
    20:49:10.370 INFO - Selenium Grid hub is up and running
    20:51:35.906 INFO - Registered a node http://12.12.0.3:4444
    20:51:37.024 INFO - Registered a node http://12.12.0.4:4444
    20:51:38.396 INFO - Registered a node http://12.12.0.5:4444
    20:51:39.782 INFO - Registered a node http://12.12.0.6:4444
    21:00:09.502 INFO - Got a request to create a new session: Capabilities [ phantomjs.ghostdriver.cli.args=--logLevel=NONE, commandTimeout=300, phantomjs.cli.args=[--web-security=false, --ssl-protocol=any, --ignore-ssl-errors=true], maxDuration=360}]
    21:00:09.503 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, browserName=phantomjs, maxInstances=1}
    21:00:13.037 INFO - Got a request to create a new session: Capabilities [ phantomjs.ghostdriver.cli.args=--logLevel=NONE, commandTimeout=300, phantomjs.cli.args=[--web-security=false, --ssl-protocol=any, --ignore-ssl-errors=true], maxDuration=360}]
    21:00:13.038 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, browserName=phantomjs, maxInstances=1}
    

    I’ve exhausted all my ideas at the moment as am wondering if anyone here might know what I am missing. Everything I can test looks like things should work fine but that’s not the case.

    Also, for what it is worth, I am able to successfully run this same Selenium Grid setup locally (minus Docker). It seems like the inclusion of Docker to the stack is what is breaking it (I’m new to Docker so let’s be honest, I’m breaking it. 🙂 )

    Thanks,

  • Docker on Raspberry Pi 2: Could not reach any registry endpoint
  • docker instance of masterless salt showing folders of my system
  • Apache Ignite cache operation failure
  • Docker separation of processes and source code control
  • Binaries inside Docker container images not being started when not explicitly called
  • How to delete untagged images from AWS ECR Container Registry
  • One Solution collect form web for “Selenium: Unable to run GhostDriver(phantomJS) node on Docker Selenium Grid Setup”

    The issue is perhaps due to proxy settings missing at your containers level. You would need to setup proxy for your docker container and then try again. You should be able to get things to work fine.

    Please refer to this article to learn how to setup proxies for your docker containers.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.