Firefox in a docker container, accessible from selenium to another

I have a docker container in which the rails application is running (call it in container A), which needs to be scrambled using the watir web browser, using firefox as the backend.

I have firefox installed in another container (container B) and I want to be able to pass in the container. Sort of:

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

So, every time watir starts firefox, a new instance of CONTAINER_A starts a new firefox.

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

+6
source share
1 answer

Yes, it is easy to do. Just run an instance of Selenium Grid (the default is a hybrid combo grid node), in the foreground on the docker server (on port 5555 or something else). You can then use Ruby with Selenium bindings (not WatiR) to control the firefox browser in a remote window.

+1
source

All Articles