https://github.com/logkirk/selenium-tools
A simple template for a selenium test library including a few extra tools to make tests more robust.
https://github.com/logkirk/selenium-tools
python qa qa-automation selenium test
Last synced: about 2 months ago
JSON representation
A simple template for a selenium test library including a few extra tools to make tests more robust.
- Host: GitHub
- URL: https://github.com/logkirk/selenium-tools
- Owner: logkirk
- License: mit
- Created: 2024-06-28T01:01:05.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-16T19:30:01.000Z (over 1 year ago)
- Last Synced: 2025-02-16T11:12:01.592Z (over 1 year ago)
- Topics: python, qa, qa-automation, selenium, test
- Language: Python
- Homepage: https://sr.ht/~logankirkland/selenium-tools/
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Selenium Tools
==============
[project](https://sr.ht/~logankirkland/selenium-tools/) /
[repo](https://git.sr.ht/~logankirkland/selenium-tools) /
[mailing list](https://lists.sr.ht/~logankirkland/selenium-tools) /
[issues](https://todo.sr.ht/~logankirkland/selenium-tools)
[](https://github.com/psf/black)
[](https://builds.sr.ht/~logankirkland/selenium-tools?)
> ℹ️ **Note**
> The canonical project locations are linked above. Other locations are mirrors.
This is a simple template for a selenium web-based test library. It includes some tools
which help make selenium-based tests more robust and reliable.
- [Description](#description)
- [File structure](#file-structure)
- [Installation](#installation)
- [Configuration](#configuration)
- [Command line usage](#command-line-usage)
- [Reporting](#reporting)
File structure
--------------
- `selenium-tools` - project root directory
- `src` - source code root directory
- `.venv` - Python virtual environment (created during installation)
- `driver` - module containing basic selenium webdriver code
- `locators` - selenium locators and related Python code
- `pages` - code related to the Page Object Model
- `tests` - test code
- `chromedriver.exe` - chromedriver (created during installation)
- `parameters.yaml` - test configuration file
- `readme.md` - this readme
- `requirements.txt` - Python requirements for installation using pip
Installation
------------
### Prerequisites
This guide assumes the following prerequisites have been met:
- Chrome browser installed
### Create Python virtual environment
Change directory to the project root directory, then execute the following command to
create the virtual environment:
```shell
python -m venv .venv
```
Then activate the virtual environment using the command appropriate for your shell.
See [the documentation](https://docs.python.org/3/library/venv.html#how-venvs-work) for
more info.
### Download chromedriver
Download the version of chromedriver matching the version of your Chrome browser
installation. See
the [Chrome for Testing](https://googlechromelabs.github.io/chrome-for-testing/) site
for download links. Extract the `.zip` file and copy the chromeriver file to the root
project directory.
### Install Python requirements
The required Python modules are listed in `requirements.txt`. Install them in your
activated virtual environment using:
```shell
python -m pip install -r requirements.txt
```
Configuration
-------------
Test configuration parameters are contained in `parameters.yaml`.
Command line usage
------------------
In the base project directory with the configured virtual environment activated, execute
the following to run all tests in the `tests.py` module:
```shell
python -m unittest tests
```
Run a specific test suite using:
```shell
python -m unittest tests.ExampleTestSuite
```
Run a specific test case using:
```shell
python -m unittest tests.ExampleTestSuite.test_example_test
```
See [unittest documentation](https://docs.python.org/3/library/unittest.html) for more
details.