We have already got to know Selenium in the past; paired with my Raspberry Pi represents a fundamental tool for creating really interesting applications.
The problem I have encountered over time is that it is not always easy to install the drivers for the browsers available for Raspbian.
Today we see how to solve the problem with Chriomium, and install Selenium in Raspbian.
Step 0: Let’s Update!
To get straight to the point, the solution revolves around an updated system. If you have the latest version of Raspbian, you will most likely be able to install the chromium-driver without too much trouble.
But let’s proceed in order and first of all update the system with the classic instructions already seen:
Obviously the process will take time, proportionally to how much your current version differs from the one released at that time.
I don’t expect you to have any problems at this level as your operating system should have everything configured so that you can upgrade without too much trouble.
Step 1: Let’s Install chromium-driver
Well, if you already have everything set up correctly, we can proceed to install the selenium driver for chromium in Raspbian using the simple command:
If all goes well, you’re done here and you should be ready to run chromium with your selenium installation.
However, if you have problems during installation, due for example to an updated version of the driver that does not correspond to the installed version of Chromium, then the steps to take before launching the above command are a little longer.
A Matter of Sources
To perform an update, Linux relies on configuration files called Apt sources, which are located in the /etc/apt directory.
Inside this folder we find several elements, of which the most important is sources.list which in turn contains the links to the sources from where the operating system can download the latest versions of the software (once the commands seen in step 0).
To unlock the Chromium issue (but not only) often the question revolves around the sources that are being considered to download updates: it is necessary to use links that allow access to well-maintained resources.
Before starting, let’s first make a nice backup of our apt folder, so that, in case of need, we can always copy the original content.
At this point, delete the contents so as to make room for a new folder that we will download shortly:
Once done, download from this link the apt folder that I use in my installation and that contains all the currently correct links.
Unzip the zip file and copy the apt folder where you prefer, for example in the Downloads folder, then move the contents to the correct location:
Before updating everything, let’s proceed to uninstall Chromium:
Then we perform step 0. When the procedure is completed, install Chromium again with the command:
And finally we perform step 1. At this point, everything should be fine and you should have the latest version of Chromium along with the latest version of the driver.
We discussed how to install Selenium drivers for Chromium. The answer is to have a system that is always up to date, obviously hoping that the developers have released the correct version of the software we would like to use.