Awesome
Info
This project offers a standalone Ubuntu Vagrant box instance containing
- Fluxbox
- tmux autologin
- Pinned User-specified version of Selenium ( 4.*, 3.x or legacy 2.53 )
- Chrome with Chrome Driver
- Firefox with Gecko Driver
- Katalon IDE (experimental)
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
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.
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_VERSION | 3.2.0 |
FIREFOX_VERSION | 54.0b13 |
GECKODRIVER_VERSION | 0.17.0 |
CHROME_VERSION | 59.0.3071.86 |
CHROMEDRIVER_VERSION | 2.30 |
SELENIUM_VERSION | 2.53 |
FIREFOX_VERSION | 45.0.1 |
CHROME_VERSION | 54.0.2840.71 |
CHROMEDRIVER_VERSION | 2.24 |
SELENIUM_VERSION | 2.47 |
FIREFOX_VERSION | 40.0.3 |
CHROME_VERSION | 50.0.2661.75 |
CHROMEDRIVER_VERSION | 2.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
-
The hub is available on
http://127.0.0.1:4444/wd/hub/static/resource/hub.html
with some delay after the Virtual Box reboot - currently there is no visual cue on when the box is ready. -
If the screen size is too low, run the following command on the host
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:
70.0.3538.110
70.0.3538.102
70.0.3538.77
70.0.3538.67
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:
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
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
- NOTE: the "and" in the condition also appears to work:
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
- Probe http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/ and /or https://google-chrome.en.uptodown.com/ubuntu/old for a valid past Chrome build is a
- Enable gecko driver
- Dockerfile - see e.g. docker, docker-selenium-firefox-chrome-beta, lucidworks/browser-tester, Docker image based on Ununtu with JDK and maven for Java
- Support downloads from chromium dev channel. More about using headless Chrome see
- Getting Started with Headless Chrome and .
- xvfb customizations, video recording
- desktop shortcut generation e.g. example for ArchLinux, chromium puppeteer
- ruby gem for authoring and managing tmux sessions easily
- constructing expression for XPath with multiple conditions in xmllint
See also:
- Google Chrome Old Versions - for Windows only
- Selected old versions
- chromium old builds for Ubuntu
- table of matching Chromedriver and Chrome browser versions
- bonigarcia/webdrivermanager allows the Java test suite to specify the browser driver verson for all standard browsers.
- abhishek8908/selenium-drivers-download-plugin maven plugin which downloads specific versions of chromedriver, iedriverServer, edge or geckodriver by executing a specific custom goal
generateDrivers
during maven life cycle. - how to disable Chrome Browser auto update
- xvfb headless selenium box blog
- examples and documentation
- parallel testing testng framerowk - note utility code redundant across various projects of that author.
- the Chromium Projects
- Chromium Puppeteer - headless Dockerfile for Debian-based box.
- Puppeteer visual recorder with Xvfb, standalone
- Puppeteer example tests
- Puppeteer web scraping tutorial
- sdkman - parallel version manager (in particular, of JDK).
- oracle logins for downloading Java SE 8 and earlier from oracle technet Java Archive Downloads page.
- shell script to install chrome latest RPM via
curl $URL | bash -
from JDK11 + chrome Dockerfile - xserver-xorg-video-dummy driver
- an old instruction for headless debian setup (via dumy X driver)
- chromium snapshots release directories
License
This project is licensed under the terms of the MIT license.