3
votes

I'm new to docker and have been messing with Docker and selenium grid for a week.

Here are the things I did,

  1. Created a container for Selenium grid and google chrome.
  2. Modified my protractor script and point it to hub created in Step 1
  3. I could see the chrome driver logs using docker logs <container-name>

My question is , is there a way that I can see the browser while the script is running?

1

1 Answers

7
votes

You can use VNC. Here's the information from the official repo

You can acquire the port that the VNC server is exposed to by running:

$ docker port <container-name|container-id> 5900
#=> 0.0.0.0:49338

In case you have RealVNC binary vnc in your path, you can always take a look, view only to avoid messing around your tests with an unintended mouse click or keyboard interrupt:

$ ./bin/vncview 127.0.0.1:49160
If you are running Boot2Docker on OS X then you already have a VNC client built-in. You can connect by entering vnc://<boot2docker-ip>:49160 in Safari or Alfred.

When you are prompted for the password it is secret. If you wish to change this then you should either change it in the /NodeBase/Dockerfile and build the images yourself, or you can define a Docker image that derives from the posted ones which reconfigures it:

#FROM selenium/node-chrome-debug:2.53.0
#FROM selenium/node-firefox-debug:2.53.0
#Choose the FROM statement that works for you.

RUN x11vnc -storepasswd <your-password-here> /home/seluser/.vnc/passwd