Home

Awesome

Info

This project offers a standalone Ubuntu Vagrant box instance containing

It is not uncommon that the 'bleeding edge' versions of the drivers don't work well together, e.g. throwing errors like: org.openqa.selenium.WebDriverException: unknown error: Chrome version must be >= 52.0.2743.0 ... (this has been observed quie often during early Selenium 3.x, and then again with 4.0.alpha releases). Likewise the Selenium hub error on the screenshot box

illustrates a likely versions mismatch between Selenium, Geckodriver and Firefox, or Selenium, ChromeDriver and Chrome.

One often wishes to enforce specific past versions of Selenium-based toolchain. Vagrant makes this easy. box

Note: Docker makes this easy too, but there is no native Docker port for Windows 8.x and earlier and this could be one's reason to stay with Vagrant.

This project contains Trusty_ 14.04 LTS Vagrantfile that is loosely based on anomen/vagrant-selenium There is also an Ubuntu Xenial 16.04 LTS Vagrantfile.xenial: there are differences in openjdk/Oracle JDK release-specific repo availability between Xenial and Trusty. Support of Ubuntu Bionic 18.04 and Focal 20.04 releases is planned - no strong depenency between the browser and OS release exits for Linux.

Usage

Download the vagrant box images of Trusty trusty-server-amd64-vagrant-selenium.box or Xenial vagrant-selenium locally, name it trusty-server-amd64-vagrant-selenium.box and xenial-server-amd64-vagrant-selenium.box respectively and store in the Downloads directory of the user.

Then run

export PROVISION_SELENIUM=true
vagrant up

or on Windows

set PROVISION_SELENIUM=true
vagrant up

For downloading box for the very first time into Downloads directory add the following setting (note: this setting is experimental):

export BOX_DOWNLOAD=true
export PROVISION_SELENIUM=true
vagrant up

Specific versions of Selenium Server, Firefox, Gecko Driver, Chrome, Chrome Driver can be set through the environment variables SELENIUM_VERSION, FIREFOX_VERSION, GECKODRIVER_VERSION, CHROME_VERSION, CHROMEDRIVER_VERSION.

if a specific version of the Selenium Jar or browser is needed, set it via

export SELENIUM_VERSION=3.141.59
export CHROME_VERSION=75.0.3770.80
export FIREFOX_VERSION=45.0.1

or

set SELENIUM_VERSION=3.5.3
set SELENIUM_VERSION=3.141.59
set CHROME_VERSION=75.0.3770.80

Also the USE_ORACLE_JAVA setting is recognized to use oracle JDK on Trusty.

export PROVISION_SELENIUM=true
export SELENIUM_VERSION=3.14.0
export USE_ORACLE_JAVA=true
export CHOME_VERSION=48.0.2564.109
export CHROMEDRIVER_VERSION=2.30
vagrant up

For the list or recognized chrome versions, inspect the Vagrantfile. Another option to lookup the available choices of Chrome browser specific release e.g. 48, is to run

ruby get_chrome_versions.rb -r 48

this will print:

["48.0.2564.109",
 "http://www.slimjetbrowser.com/chrome/lnx/chrome64_48.0.2564.109.deb"]

therefore one must set the CHROMEDRIVER_VERSION to 48.0.2564.109 if a release 48 is intended.

Few supported combinations of legacy browser and driver versions are listed below. Note: this list is provided as an example, and is not maintained.

SELENIUM_VERSION3.2.0
FIREFOX_VERSION54.0b13
GECKODRIVER_VERSION0.17.0
CHROME_VERSION59.0.3071.86
CHROMEDRIVER_VERSION2.30
SELENIUM_VERSION2.53
FIREFOX_VERSION45.0.1
CHROME_VERSION54.0.2840.71
CHROMEDRIVER_VERSION2.24
SELENIUM_VERSION2.47
FIREFOX_VERSION40.0.3
CHROME_VERSION50.0.2661.75
CHROMEDRIVER_VERSION2.16

With Chrome, stable, unstable or beta are valid versions, appropriate .deb package from the google repository will be installed.

The Vagrantfile automates the download of specific old build of from https://www.slimjet.com/chrome/google-chrome-old-version.php. Note, there are no old Chrome builds 87.x, 88.x, or 89.x and __91__through 101 there Check if desired version is available. There is also were few relatively recent 32-bit Chrome builds there. Note the Chrome browser is often re-released over time with the same major and minor version like e.g. 69.0.3497.100 vs. 69.0.3497.92 builds 72.0.3626.68 vs. 72.0.3626.96 vs. 72.0.3626.109 vs. 72.0.3626.119 and so on, with major version number bumps relatively unfrequent. The build one can find on slimjet is not always the very latest one of those - therefore it is not recommended to use Slimjet with the very recent past builds.

Internaly the chromedriver communicates with Chrome browser via WebSockets DevTools debugging interface.

Note that the actual download directory http://www.slimjetbrowser.com/chrome/lnx/ is not directly browsable. Alternatively a handful of really old Chrome browser debian packages can be manually downloaded from https://google-chrome.en.uptodown.com/ubuntu/old.

Note: the runtime error Unsupported major.minor version 52.0 is a manifestation of a Java version mismatch between the Selenium.jar and the environment. For Ubuntu Trusty, one can switch to JDK 8 by setting the USE_ORACLE_JAVA environment to true and re-provision the box.

Limitations

vboxmanage controlvm "Selenium Fluxbox" setvideomodehint 1280 900 32

this currently works with trusty but not always with xenial base box in Virtual Box.

Note Latest old Chrome builds

The Chrome Build 70 had multiple releases:

Not every build is available in slimjet.

Usage with Java projects

A minimal example Java TestNG parallel run Selenium test project is provided in the example direcrory:

box

It will further benefit from inegrating with vagrant-maven-plugin plugin and simple-ssh jar e.g. to manage browsers and browser drivers in the Virtualbox after the test completion thru ssh using Vagrant-generated keys - this is work in progress.

one can find the key file location from Vagrant by running the command

C:\HashiCorp\Vagrant\bin\vagrant.exe ssh-config

It would print something like

Host default
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
	
  IdentitiesOnly yes
  LogLevel FATAL	

but only if the Virtual Box VM was started by vagrant. Vagrant will refuse to give this information when VM was launched through Virtual Box UI directly.

Latest Chrome for Testing

To automatically download the stable chromedriver for Chrome testing from Chrome for Testing availability page

chrome-for-testing

one can use this command (currntly it is quite long):

xmllint --htmlout --html --xpath "//section[@id='stable']/div[@class='table-wrapper']/table/tbody/tr/th[code='chromedriver']/../th[code = 'linux64']/../td[code='200']/../td[1]/code/text()" chrome-for-testing.html 2>/dev/null

this will print:

https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/119.0.6045.105/linux64/chromedriver-linux64.zip

xmllint --htmlout --html --xpath "//section[@id='stable']/div[@class='table-wrapper']/table/tbody/tr[th/code='chromedriver' and td/code='200' and th/code='linux64']/td[1]/code/text()" chrome-for-testing.html 2>/dev/null
https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/119.0.6045.105/linux64/chromedriver-linux64.zip

and so is the following two step extraction:

xmllint --htmlout --html --xpath "//div[@class='table-wrapper summary']/table/tbody/tr[th/a/text()='Stable']/td[1]/code/text()" chrome-for-testing.html 2>/dev/null

119.0.6045.105

xmllint --htmlout --html --xpath "//code[contains(text(),'/119.0.6045.105/') and contains(text(),'chromedriver-linux64')]/text()" chrome-for-testing.html 2>/dev/null
https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/119.0.6045.105/linux64/chromedriver-linux64.zip

Work in Progress

See also:

License

This project is licensed under the terms of the MIT license.

Author

Serguei Kouzmine