How to install Selenium in Linux

Geomario
FAUN — Developer Community 🐾
3 min readNov 9, 2021

--

Running automation tests hosted in Linux servers irrevocably leads to the question, How to install Selenium in Linux?

Linux Server

In my everyday job as a software developer, I host automation processes in dedicated Linux servers. Can Selenium run on Linux? It was my first question. Let's remember, a Linux server runs without a graphical user interface. Moreover, automation execution resembles actions in a browser, needing a window popping up every time. Thus, how does Selenium work in Linux servers?

Running automation processes without GUI (web browser) it is called “Headless state”

How does Selenium work in Linux servers?

The state is called a Headless state, it allows us to perform any automation without the need of a window browser, — a popping window every 3 seconds would be annoying, isn't it?. Besides, It gives us the ability to perform operations faster without the GUI implementation. Attributable to in headless mode, there is no need for loading JavaScript, CSS, and HTML for the web browser. So, can Selenium run in windows? yes.

Automation processes in Headless mode run 2 to 10 times faster

Geomario talking to servers

Selenium on Linux Server

To get Selenium in Linux server, we need to get Selenium, Chromedriver, and Chrome in binary version.

1 ) Update the system

On any occasion, when you get into your Linux machine, update the packages.

2) Install Chrome Binary

As we talked about, we need to emulate the actions in a web browser, we need to install the chrome binary.

We will install the latest stable version of Chrome. This is important to remember, while it will work just with the specific chrome driver version.

3) Install Chromedriver

This step is crucial. The chrome driver works specifically with the chrome version you have installed.

If your script is not running and tells you that there is a mismatch, be sure you installed the right version of your chrome browser binary that matches your chrome driver.

Since we have installed, the latest version of Chrome in step 2, we have version 95. We must install version chrome driver version 95.

Notice line 2, after the domain, I set the version to download (95.0.4638.54). If you have problems when running in a Headless state because of a mismatch, give it a look there. You can check which version of Chrome works with which version of chrome driver here:

4) Install Selenium

We are ready! Let's test our installation.

5) Python Script & Selenium

Let us create our python script and try to get the python title from www.python.org.

When we run our script, the title element from the web page www.python.org will be displayed:

Welcome to Python.org

That's it!, you are ready to implement Selenium on Linux servers.

Is it too much to ask you to clap 👏🏽 the tutorial if you like it?

Check my YouTube Channel!

Adios!

Join FAUN: Website 💻|Podcast 🎙️|Twitter 🐦|Facebook 👥|Instagram 📷|Facebook Group 🗣️|Linkedin Group 💬| Slack 📱|Cloud Native News 📰|More.

If this post was helpful, please click the clap 👏 button below a few times to show your support for the author 👇

--

--