Firefox in a docker container accessible from selenium in another
Asked Answered
I

1

6

I have a docker container running a rails app (let's call it container A) that needs to do some scraping with watir webdriver using firefox as backend.

I have firefox installed in another container (container B) and I want to be able to pass in container A something like:

Selenium::WebDriver::Firefox::Binary.path= $DOCKER_RUN_CONTAINER_A

So, each time watir launches firefox a new instance of CONTAINER_A launches a new firefox.

I know it's easy to make containers communicate using ports, but how about executables? And, by the way, does it look like a good design idea isolating firefox in a separate container?

Ingalls answered 11/5, 2014 at 19:10 Comment(2)
This is an interesting question. Sad there are no answers. Did you ever get to a point where you could answer it yourself?Millrace
@AbeHeward, I managed to workaround the issue using the elgalu/docker-selenium image and link the image using fig (now called docker-compose).Ingalls
D
1

Yes, this is easy to do. Just run an instance of Selenium Grid (which is a grid-node hybrid combo by default) , in the foreground on the docker server (on port 5555 or whatever). Then you can use Ruby with Selenium bindings (not WatiR) to drive the firefox browser on the remote box.

Decide answered 18/6, 2015 at 0:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.