This makes it possible to write tests in the language that you are most comfortable with. In addition, Selenium has a large user community that provides support and help when needed. This tutorial will help you to configure the environment for Selenium with Python and Chrome on Fedora. We will discuss an example written in Python.

Prerequisites

Assuming you have access to a Fedora system with a Sudo privileged account. This tutorial can be run with GUI access or shell access only.

Step 1 – Installing Google Chrome

You can use firefox or Google Chrome web browser to run your selenium test cases. In this article, we will discuss examples with the Google Chrome web browser. So, Let’s install Google chrome first. Enable the google-chome repository with the below-mentioned commands: Now, install the latest google chrome stable web browser: Google Chrome will be installed on your Fedora system.

Step 2 – Setup Python Environment

We will create a virtual environment for running our Python test cases. Follow the below steps to create Python virtual environment, and install the required modules.

Step 3 – Running an Example with Selenium Python

The Python virtual environment is ready to run Selenium scripts. Let’s run an example script, that opens a website in a headless (Useful for remote ssh access) google chrome browser and prints the title of the website. Make sure the Python virtual environment is active. you can identify that using the terminal prompt. Now create a Python script and edit it in a text editor. Copy-paste the below snippet to file:

Press CTRL +O to write changes and then press CTRL + X to exit from the editor. Now, run your Python script: You will see the output something like below: At the first run, the script will download the latest chromedriver and place it in your system to use for the next executions. In the output, you can see the title of the given website is printed on the screen.

Conclusion

Selenium is a popular tool among website testers for running automatic test cases. In this tutorial, we have discussed configuring the Selenium environment with Python scripts.

Setup Selenium with Python and Chrome on Fedora   TecAdmin - 17Setup Selenium with Python and Chrome on Fedora   TecAdmin - 61Setup Selenium with Python and Chrome on Fedora   TecAdmin - 93