2

I've requirement to run test cases on separate chrome browsers running inside docker container.

I've install chrome docker containers as below

docker run -d -p 4444:4444 -p 5900:5900 -v /dev/shm:/dev/shm selenium/standalone-chrome-debug:3.8.1-francium

docker run -d -p 4444:4444 -p 5901:5900 -v /dev/shm:/dev/shm selenium/standalone-chrome-debug:3.8.1-francium
  • I have scripts which does unique tasks like analytics testing, performance testing etc so I can't use Grid approach here.

  • This is what I do in case of single chrome browser but I need to point to a particular docker container image

    WebDriver driver = new RemoteWebDriver( new URL("http://localhost:4444/wd/hub"), DesiredCapabilities.firefox());

vikramvi
  • 3,312
  • 10
  • 45
  • 68
  • bind the port to the standalone server with a different port nulber: `docker run -d -p 5900:4444 -v ...` and `docker run -d -p 5901:4444 -v ...` . Then connect to standalone server with `new RemoteWebDriver( new URL("http://localhost:5900/wd/hub")` or `new RemoteWebDriver(new URL("http://localhost:5901/wd/hub")` for the second instance. – Florent B. Jan 30 '18 at 17:49
  • Thanks let me try it & update back. Can you please explain in details "...-d -p 4444:4444 -p 5900:5900..". I couldn't find any good documentation for this @FlorentB. – vikramvi Jan 31 '18 at 05:40

1 Answers1

2

Got it working with help of comment from @Flore B.

docker run -d -p 5902:4444 -p 5903:5900 -v /dev/shm:/dev/shm selenium/standalone-chrome-debug:3.8.1-francium

RemoteWebDriver url

http://0.0.0.0:5902/wd/hub
vikramvi
  • 3,312
  • 10
  • 45
  • 68