This article setting up Selenium for web automation by installing the Selenium library using pip. Additionally, you’ll configure the required WebDriver (e.g., ChromeDriver or GeckoDriver) to interact with web browsers, ensuring your environment is ready for seamless browser automation.
Install Selenium via pip
- Open a terminal or Command Prompt.
- Run the following command to install Selenium
Verify the installation
Download the Appropriate WebDriver
Selenium requires a browser-specific WebDriver for automation. Download the WebDriver that matches your browser version:
- ChromeDriver for Chrome:
- Download from: ChromeDriver Downloads
- GeckoDriver for Firefox:
- Download from: GeckoDriver Releases
- EdgeDriver for Microsoft Edge:
- Download from: EdgeDriver Downloads
- Unzip the WebDriver and place it in a known location (e.g., C:\WebDrivers).
Add WebDriver to System PATH
- For Windows:
- Go to System Properties → Environment Variables → Edit the Path variable.
- Add the path to the WebDriver executable (e.g., C:\WebDrivers).
With this, your setup is complete.
Installing Selenium and Configuring Web Driver