Getting fast-forward with Pytest and Selenium
In a previous tutorial, we configured everything from scratch. In this one, we will check out a project from GitHub that has the preconditions for executing almost right-at-the-bat. The difference here will rely on project initialization.
Note: Git should be installed and configured in the PATH. If not, you can follow the following tutorial.
Step-by-step guide:
Note: ChromeDriver is required to be downloaded and added to the PATH environment variable in windows. To do that, follow the next resource.
Install Python
- Go to the Python site and hit download to the latest version available.
- Once the download is complete, proceed with the installation. Consider including the executable in the Windows PATH location. That is in one of the steps of the installation wizard.
- A computer restart might be required. To check if Python was added to your PATH, open a Power Shell console and just type and hit enter:
If a bunch of messages is displayed indicating that parameters are missing, then you are good to go, otherwise, a computer restart is mandatory.python
Next up: Install the IDE
Install PyCharm
- Go to the Jetbrains site and hit download to the latest version available.
- Once the download is complete, proceed with the installation.
Next up: Checking out the project
Checking out the project
- Create a new folder where you want to download the repository.
- Inside the folder right-click -> Open PowerShell window here
- Once the PowerShell console is open, type:
git clone https://github.com/waltervr/pylenium.git
- That will download the project
Next up: Open and set up the project
Open and set up the project
- Open PyCharm
- Click on File -> Open and search for your project and select to open
- To be able to install all dependencies in fast-forward mode, pipenv is required. For more information about pipenv, please visit this video. In the terminal, execute the following command:
pip install pipenv
- Now its time to install the dependencies in a fast-forward mode thanks to the pip file in the project
- Open the terminal within Pycharm and execute:
pipenv install
- That should install pytest and selenium and you should be ready to run your project with
pipenv run python -m pytest