This guide provides step-by-step instructions to set up and run your Selenium testing code on a local Windows environment.
- Python installed (preferably Python 3.x)
- Basic knowledge of Python and Selenium
- Google Chrome browser installed
- ChromeDriver corresponding to your Chrome version
- The Selenium testing code
-
Download Python:
- Go to the official Python website and download the latest version of Python.
-
Install Python:
- Run the installer and make sure to check the box that says "Add Python to PATH."
- Complete the installation by following the prompts.
-
Verify Installation: Open a command prompt and run:
python --version
- Open Command Prompt:
- Press
Win + R, typecmd, and hit Enter
- Press
- Install Selenium using Pip:
- In the command prompt, run:
pip install selenium
-
Check Chrome Version:
- Open Google Chrome.
- Click on the three-dot menu in the top right corner > Help > About Google Chrome.
- Note the version number (e.g., 93.0.4577.63).
-
Download ChromeDriver:
- Go to the ChromeDriver download page.
- Download the version that matches your Chrome version.
- Extract the downloaded file (e.g., chromedriver.exe).
-
Add ChromeDriver to PATH:
- Move chromedriver.exe to a folder of your choice (e.g., C:\chromedriver).
- Add this folder to your system PATH:
- Right-click on
This PCorComputerand selectProperties.- Click on "Advanced system settings."
- Click on the "Environment Variables" button.
- In the "System variables" section, find the "Path" variable and select it.
- Click "Edit," then "New," and add the path to the folder containing chromedriver.exe.
- Click "OK" to close all dialog boxes.
- Right-click on
- Open your selenium script
ui_test.pyfile.
-
Open Command Prompt: Press
Win + R, type cmd, and hit Enter. -
Navigate to Your Script's Directory: Use the cd command to navigate to the directory where your
ui_test.pyfile is located:cd path_to_your_script_directory -
Run Your Script: In the command prompt, run:
python ui_test.py
This guide provides the steps to set up and run your Selenium tests on a local Windows environment. If you encounter any issues or have questions, feel free to seek help or consult the official Selenium documentation.
- Create a new file named
README.mdin your project directory. - Copy and paste the above content into that file.
- Save the file.
This README.md file will serve as a comprehensive guide for anyone looking to set up and run Selenium testing code on a local Windows environment. If you need any modifications or additional information, let me know!