Skip to content

Latest commit

 

History

History
86 lines (59 loc) · 3.15 KB

README.md

File metadata and controls

86 lines (59 loc) · 3.15 KB

selenium-pytest-automation

Pytest Automation with Selenium

Setup Instructions

Python Setup

You can download the latest Python version from Python.org.

also requires pipenv. To install pipenv, run pip install pipenv from the command line.

You should also have a Python editor/IDE of your choice. Good choices include Visual Studio Code and PyCharm.

WebDriver Setup

For Web UI testing, you will need to install the latest versions of Microsoft Edge Google Chrome and Mozilla Firefox. You can use other browsers with Selenium WebDriver, but the course will use Microsoft Edge, Chrome and Firefox.

You will also need to install the latest versions of the WebDriver executables for these browsers: EdgeDriver for Microsoft Edge, ChromeDriver for Chrome and geckodriver for Firefox. Each test case will launch the WebDriver executable for its target browser. The WebDriver executable will act as a proxy between the test automation and the browser instance. Please use the latest versions of both the browsers and the WebDriver executables. Older versions might be incompatible with each other.

EdgeDriver, ChromeDriver and geckodriver must be installed on the system path.

WebDriver Setup for Windows

To install ChromeDriver and geckodriver on Windows:

  1. Create a folder named C:\Selenium.
  2. Move the executables into this folder.
  3. Add this folder to the Path environment variable.

Test WebDriver Setup

To verify correct setup on any operating system, simply try to run them from the terminal:

$ msedgedriver
$ ChromeDriver
$ geckodriver

You may or may not see any output. Just verify that you can run them without errors. Use Ctrl-C to kill them.

Project Setup

  1. Clone this repository.
  2. Run pipenv install to install the dependencies.
  3. Run pipenv run python -m pytest to verify that the framework can run tests.

Project Setup Troubleshooting

A few people attempting to set up this project encountered the following error when executing pipenv run python -m pytest:

ModuleNotFoundError: No module named 'atomicwrites'
  • Upgrade Python to the latest versions. The following worked for me on Windows:
    • Python 3.11.4 (python --version)
    • pip 23.1.2 (pip --version)
    • pipenv 2023.7.11 (pipenv --version)
  • Run pipenv update from within the project directory.

If upgrades don't work, try forcing package installation:

  • Run pipenv install pytest from within the project directory.
  • Run pipenv install atomicwrites from within the project directory.

If these steps don't work in your project, then try to run without pipenv:

  • Install Python packages directly using pip.
  • Run tests directly using python -m pytest.