Skip to content

joachimmaes/vagrant-selenium-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vagrant-selenium-server

A recipe to build a Vagrant box that runs Selenium Server.

The produced precise64-selenium-server.box includes Firefox and Chromium that run on Xvfb. It also includes FFmpeg to allow to make a video recording of test runs.

Recipe

Because the provisioning step takes some minutes, the idea is to up this box once and then package it as a new base box. Thus, it starts with the precise64 base box, resulting in a new precise64-selenium-server base box.

$ vagrant up
$ vagrant package --output precise64-selenium-server.box

$ vagrant box list
$ vagrant box remove precise64-selenium-server
$ vagrant box add precise64-selenium-server precise64-selenium-server.box
$ vagrant destroy

$ rm precise64-selenium-server.box

Usage

Assume we have a configuration as in test/Vagrantfile.

$ vagrant up

Xvfb and Selenium Server will be started automatically during boot time.

From a test client, use:

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

To record video:

$ vagrant ssh -- /home/vagrant/bin/start_record_video.sh /vagrant/video.mov

This will start recording whatever plays on display :99

To watch what is happening you can expose the Xvfb via VNC, at a guest shell:

$ x11vnc -storepasswd
$ x11vnc -rfbauth /home/vagrant/.vnc/passwd  -display :99 -many

Alternate approach using SSH tunneling, at the host shell, e.g.:

$ ssh -L 5900:localhost:5900 [email protected] 'x11vnc -rfbauth /home/vagrant/.vnc/passwd -localhost -display :99 -many'

You can also check the open session on Selenium Server, e.g. at http://192.168.44.10/wd/hub

References

Inspiration and parts taken from:

About

A recipe to build a Vagrant box that runs Selenium Server.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published