|
1 | | -## Python unittest automation Lambdatest |
| 1 | +# Python-Selenium-Sample |
2 | 2 |
|
3 | | -Python selenium automation sample test for [LambdaTest](https://www.lambdatest.com/) cloud-based Selenium Grid. |
| 3 | + |
4 | 4 |
|
| 5 | +## Prerequisites |
5 | 6 |
|
6 | | -## Install Python |
7 | | - - Download the latest python build from https://www.python.org/downloads/ |
8 | | - - Make sure pip should installed. you can check using `pip --version` |
| 7 | +1. Install pip and python. |
9 | 8 |
|
| 9 | +``` |
| 10 | +sudo apt install python-pip |
| 11 | +sudo apt install python |
| 12 | +``` |
10 | 13 |
|
11 | | -### Configuring Test |
12 | | -- Replace {username} with your username |
13 | | -- Replace {accessToken} with your username |
14 | | -- List of supported platfrom, browser, version can be found at https://www.lambdatest.com/capabilities-generator/ |
| 14 | +2. The recommended way to run your tests would be in virtualenv. It will isolate the build from other setups you may have running and ensure that the tests run with the specified versions of the modules specified in the requirements.txt file. |
15 | 15 |
|
| 16 | +``` |
| 17 | +pip install virtualenv |
| 18 | +``` |
16 | 19 |
|
17 | | -### Installating Dependencies |
18 | | -```bash |
19 | | -pip install selenium |
20 | | -export PYTHONWARNINGS="ignore:Unverified HTTPS request" //Disable ssl warning |
| 20 | +## Steps to Run your First Test |
| 21 | + |
| 22 | +Step 1. Clone the Python-Selenium-Sample Repository. |
| 23 | + |
| 24 | +``` |
| 25 | +git clone https://github.com/LambdaTest/python-selenium-sample |
21 | 26 | ``` |
22 | 27 |
|
23 | | -### Executing Test |
24 | | -```bash |
25 | | -python google-search-lambdatest.py |
| 28 | +Step 2. Next we create and Activate the virtual environment in the Python-Selenium-Sample folder. |
| 29 | + |
| 30 | +``` |
| 31 | +virtualenv venv |
| 32 | +source venv/bin/activate |
| 33 | +``` |
| 34 | + |
| 35 | +Step 3. Then install required packages. |
| 36 | + |
| 37 | +``` |
| 38 | +pip install -r requirements.txt |
26 | 39 | ``` |
| 40 | + |
| 41 | +Step 4. Inside Python-Selenium-Sample folder, export the Lambda-test Credentials. You can get these from your automation dashboard. |
| 42 | + |
| 43 | +<p align="center"> |
| 44 | + <b>For Linux/macOS:</b> |
| 45 | + |
| 46 | +``` |
| 47 | +export LT_USERNAME="YOUR_USERNAME" |
| 48 | +export LT_ACCESS_KEY="YOUR ACCESS KEY" |
| 49 | +``` |
| 50 | + |
| 51 | +<p align="center"> |
| 52 | + <b>For Windows:</b> |
| 53 | + |
| 54 | +``` |
| 55 | +set LT_USERNAME="YOUR_USERNAME" |
| 56 | +set LT_ACCESS_KEY="YOUR ACCESS KEY" |
| 57 | +``` |
| 58 | + |
| 59 | +Step 5. To run your first test. |
| 60 | +``` |
| 61 | +python lambdatest.py |
| 62 | +``` |
| 63 | + |
27 | 64 | ## About LambdaTest |
28 | | -[LambdaTest](https://www.lambdatest.com/) is a cloud based selenium grid infrastructure that can help you run automated cross browser compatibility tests on 2000+ different browser and operating system environments. LambdaTest supports all programming languages and frameworks that are supported with Selenium, and have easy integrations with all popular CI/CD platforms. It's a perfect solution to bring your [selenium automation testing](https://www.lambdatest.com/selenium-automation) to cloud based infrastructure that not only helps you increase your test coverage over multiple desktop and mobile browsers, but also allows you to cut down your test execution time by running tests on parallel. |
| 65 | + |
| 66 | +[LambdaTest](https://www.lambdatest.com/) is a cloud based selenium grid infrastructure that can help you run automated cross browser compatibility tests on 2000+ different browser and operating system environments. LambdaTest supports all programming languages and frameworks that are supported with Selenium, and have easy integrations with all popular CI/CD platforms. It's a perfect solution to bring your [selenium automation testing](https://www.lambdatest.com/selenium-automation) to cloud based infrastructure that not only helps you increase your test coverage over multiple desktop and mobile browsers, but also allows you to cut down your test execution time by running tests on parallel. |
0 commit comments