Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/r2dev2/autoparaselenium
A library to make concurrent selenium tests that automatically download and setup webdrivers
https://github.com/r2dev2/autoparaselenium
concurrency parallel pytest python python3 selenium selenium-python
Last synced: 3 months ago
JSON representation
A library to make concurrent selenium tests that automatically download and setup webdrivers
- Host: GitHub
- URL: https://github.com/r2dev2/autoparaselenium
- Owner: r2dev2
- License: mit
- Created: 2021-07-11T06:08:42.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-07-28T04:54:06.000Z (over 1 year ago)
- Last Synced: 2024-10-12T04:34:56.090Z (3 months ago)
- Topics: concurrency, parallel, pytest, python, python3, selenium, selenium-python
- Language: Python
- Homepage:
- Size: 50.8 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AutoParaSelenium
A library to make parallel selenium tests that automatically download and setup webdrivers
## Usage
### Installation
```
pip install autoparaselenium
```### Code
The API is very simple
```python
from typing import Unionfrom selenium import webdriver
from autoparaselenium import configure, chrome, firefox, run_on, all_, Extension
# All parameters are optional, but still call it once before everything
configure(
extensions=[
Extension(chrome="path to chrome extension to install"),
Extension(firefox="path to firefox extension to install"),
Extension(chrome="chrome path", firefox="firefox path")
],
headless=True, # if there are chrome extensions, chrome will not be headless as a selenium limitation
selenium_dir="./drivers"
)@run_on(all_)
def test_both_firefox_and_chrome(web: Union[webdriver.Firefox, webdriver.Chrome]):
...@run_on(firefox)
def test_firefox_only(web: webdriver.Firefox):
...@run_on(chrome)
def test_chrome_only(web: webdriver.Chrome):
...
```### Running
Use `pytest --tests-per-worker PROC` where `PROC` is the number of parallel threads
## Credits
* [pytest-parallel python3.9 support fork](https://github.com/andni233/pytest-parallel/tree/python39-support)