|
1 | | -# Running all tests from Selenium python example |
| 1 | +# Running tests from Selenium Python examples |
2 | 2 |
|
3 | | -Follow these steps to run all test example from selenium python |
4 | | - |
5 | | -1. Clone this repository |
| 3 | +#### 1. Clone this repository |
6 | 4 |
|
7 | 5 | ``` |
8 | 6 | git clone https://github.com/SeleniumHQ/seleniumhq.github.io.git |
9 | 7 | ``` |
10 | 8 |
|
11 | | -2. Navigate to `python` directory |
| 9 | +#### 2. Navigate to `python` directory |
12 | 10 |
|
13 | 11 | ``` |
14 | 12 | cd seleniumhq.github.io/examples/python |
15 | 13 | ``` |
16 | 14 |
|
17 | | -3. Install dependencies using pip |
| 15 | +#### 3. Create a virtual environment |
| 16 | + |
| 17 | +- On Windows: |
| 18 | + |
| 19 | +``` |
| 20 | +py -m venv venv |
| 21 | +venv\Scripts\activate |
| 22 | +``` |
| 23 | + |
| 24 | +- On Linux/Mac: |
| 25 | + |
| 26 | +``` |
| 27 | +python3 -m venv venv |
| 28 | +source venv/bin/activate |
| 29 | +``` |
| 30 | + |
| 31 | +#### 4. Install dependencies: |
18 | 32 |
|
19 | 33 | ``` |
20 | 34 | pip install -r requirements.txt |
21 | 35 | ``` |
22 | | -> if you are on a different python version, for example python3.x you may have to replace `pip` with `pip3` |
23 | 36 |
|
24 | | -4. Run all tests |
| 37 | +> for help, see: https://packaging.python.org/en/latest/tutorials/installing-packages |
| 38 | +
|
| 39 | +#### 5. Run tests |
| 40 | + |
| 41 | +- Run all tests with the default Python interpreter: |
25 | 42 |
|
26 | 43 | ``` |
27 | 44 | pytest |
28 | 45 | ``` |
29 | 46 |
|
30 | | -> Please keep some patience - If you are doing it for the first time, it will take a little while to verify and download the browser drivers |
| 47 | +- Run all tests with every installed/supported Python interpreter: |
31 | 48 |
|
32 | | -## Execute a specific example |
33 | | -To run a specific Selenium Python example, use the following command: |
34 | | -```bash |
| 49 | +``` |
| 50 | +tox |
| 51 | +``` |
| 52 | + |
| 53 | +> Please have some patience - If you are doing it for the first time, it will take a little while to download the browser drivers |
| 54 | +
|
| 55 | +- Run a specific example: |
| 56 | + |
| 57 | +``` |
35 | 58 | pytest path/to/test_script.py |
36 | 59 | ``` |
37 | 60 |
|
38 | | -Make sure to replace `path/to/test_script.py` with the path and name of the example you want to run. |
| 61 | +> Make sure to replace `path/to/test_script.py` with the path and name of the example you want to run |
0 commit comments