Cross_Column

Friday, 30 January 2026

Selenium Environment Setup



Selenium with Python – Installation & Setup Guide

⚙ Selenium with Python – Installation & Setup Guide

Before starting automation with Selenium, we need a proper environment setup. This includes installing Python, VS Code, Selenium, WebDriver, and configuring everything correctly.


🐍 Installing Python

Python is the programming language used to write Selenium automation scripts.

Steps:
  • Download Python from official website
  • Run the installer
  • Check ✅ “Add Python to PATH”
  • Complete installation

Verify installation:

python --version
---

🧑‍💻 Installing VS Code

Visual Studio Code (VS Code) is a lightweight and powerful code editor used for Python automation development.

Steps:
  • Download VS Code
  • Install it on your system
  • Open VS Code
---

⚙ VS Code Setup for Python Automation

To use Python in VS Code, install the required extensions.

Required Extensions:
  • Python (by Microsoft)
  • Pylance
  • Python Debugger

After installation:

  • Select Python Interpreter
  • Create a project folder
  • Create a file: test.py
---

📦 Installing Selenium in Python

Selenium can be installed using pip (Python package manager).

pip install selenium

Verify installation:

pip show selenium
---

🌐 Installing WebDriver (ChromeDriver, EdgeDriver, GeckoDriver)

WebDriver is required to control browsers.

Drivers:
  • Chrome → ChromeDriver
  • Firefox → GeckoDriver
  • Edge → EdgeDriver

Steps:

  • Check your browser version
  • Download matching WebDriver version
  • Extract the driver file
---

🛠 Setting WebDriver Path

There are two ways to set WebDriver path:

Method 1: System Path
  • Add driver folder to system environment variables
Method 2: Direct Path in Code
from selenium import webdriver

driver = webdriver.Chrome(executable_path="C:/drivers/chromedriver.exe")
---

🚀 First Selenium Script in Python

Here is your first Selenium automation script:

from selenium import webdriver
from selenium.webdriver.common.by import By
import time

driver = webdriver.Chrome()
driver.get("https://www.google.com")

time.sleep(3)
driver.quit()
This script will:
  • Open Chrome browser
  • Open Google website
  • Wait for 3 seconds
  • Close the browser
---

▶ Running Selenium Script in VS Code

Steps to run Selenium script:

  • Open project folder in VS Code
  • Open terminal
  • Run command:
python test.py

OR

  • Right click on file
  • Click Run Python File in Terminal
---
🎯 Conclusion:

After completing this setup, your system is fully ready for Selenium automation with Python. Now you can start writing real automation scripts, building frameworks, and creating professional automation projects.

No comments:

Post a Comment

Few More

Interview & Real-Time Examples

Advanced Selenium Automation Guide with Python 🚀 Advanced Selenium Automation with Python...