0

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.

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,

jaredgilmore
  • 657
  • 8
  • 17
  • Does your company use a proxy server for regulating internet traffic ? I think `8.8.8.8` is Google's public DNS and thats why its not able to resolve internal sites, since the internal sites are never exposed outside of your company network. So trying to resolve via them would not work. – Krishnan Mahadevan Jun 12 '17 at 07:49
  • My docker containers aren't using `8.8.8.8` as the DNS entry. In the selenium/hub's `resolv.conf` the DNS entries are set to: `nameserver 10.xxx.xxx.xxx` `nameserver 10.xxx.xxx.xxx` Which is the correct DNS entries that should be able to resolve the internal sites. I can also ping the internal sites within the containers. – jaredgilmore Jun 13 '17 at 20:53
  • Thanks for clarifying that. I dont think ping is equivalent to you requesting for some content over http (which is what a browser does). For details on the difference maybe you can refer to [this](https://superuser.com/a/1002288) post. Can you please check if `wget` works for you instead of ping ? – Krishnan Mahadevan Jun 14 '17 at 07:14
  • @KrishnanMahadevan, thanks for the reply. Hopped on the `selenium/hub` container and performed 2 wgets, one to my internal site and one to google, both look like they succeeded, however both of them state at the end of the `wget` that: "index.html: Permission denied". Also hitting my internal site goes to a 302 (this happens when not going through the proxy) so that's good. The wget on http://www.google.com is a 200 OK. – jaredgilmore Jun 14 '17 at 15:06
  • So I guess it boils down to setting proxy servers at the container levels. – Krishnan Mahadevan Jun 14 '17 at 15:45
  • Is there a way to do that? I'm fairly new to docker. If you could point me in the right direction I would appreciate it! – jaredgilmore Jun 14 '17 at 16:01
  • You can try following the instructions that are detailed [here](https://docs.docker.com/engine/admin/systemd/#runtime-directory-and-storage-driver) and see if that helps. – Krishnan Mahadevan Jun 14 '17 at 16:02
  • Will do. Thank you very much for the assistance @KrishnanMahadevan! – jaredgilmore Jun 14 '17 at 16:03
  • I have added that as an answer to your query. Please help accept it, if that resolves your issue. – Krishnan Mahadevan Jun 14 '17 at 16:06
  • Will do. Thanks! – jaredgilmore Jun 14 '17 at 16:26
  • @KrishnanMahadevan unfortunately that did not work. I followed the instructions on the docker doc you posted and confirmed the docker Environment has a `HTTP_PROXY` set. Confirmed with the IT team at my business that we use a HTTP proxy, as well. – jaredgilmore Jun 14 '17 at 21:02
  • In that case, I guess I will side step and let someone help you with an answer. – Krishnan Mahadevan Jun 15 '17 at 04:26

1 Answers1

0

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.

Krishnan Mahadevan
  • 14,121
  • 6
  • 34
  • 66