Like any third party plugin, the selenium package maintainers require some time before the code is readily workable with the latest version of Firefox. As a result it is good practice to install an older, standalone version of Firefox in Ubunutu for Selenium’s use. It doesn’t take long and this will get you up and running in no time.
Note: This also solves problems when you are seeing the following error“version xul24.0 not defined in file libxul.so” – or any xul version (example follows) “version xul**.0 not defined in file libxul.so” – where ** actually refers to the Firefox version.
Firstly you need to check what version of Selenium you are running. Type the following in a terminal window:
From the above you can extract the version from the file names, ie “Selenium-2.36.0-py2.7″, so you know you are running version 2.36.
Next you are going to check the Selenium compatibility matrix on Github and using v2.36, find what the latest version of Firefox is that you can use. At the time of writing it was version 23.
As you now have the Firefox version you require, head over to the historic download page that Mozilla provides and download the tar file which corresponds to the version you require.
Having downloaded the above, untar it into the /opt/selenium_firefox directory. You will have to create this directory or do a sudo mv of the uncompressed Firefox directory.
IMPORTANT: Make sure you have turned automatic updates in Firefox to “Always Ask”. This way you can still update your main Ubuntu Firefox installation but your selenium version will stay untouched.
Now it’s time to get coding. By default Selenium will try to use your Ubuntu installed Firefox however, we are going to tell it to use our specific, outdated version:Python
from selenium import webdriver