Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content
No results
  • About AskPython
  • Blog
  • Contact Me
  • Free Online Developer Tools Hub
  • Home
  • Meet the Team
  • Privacy Policy
  • Python
  • Python Course for Beginners Online FREE
  • Python Tutorial – Mega Index
  • Terms and Conditions

🚀 Supercharge your YouTube channel's growth with AI.

Try YTGrowAI Free
  • Home
  • Blog
  • About AskPython
  • Python Course
  • Start Here

Python Selenium Introduction and Setup

  • Pranjal SrivastavaPranjal Srivastava
  • January 29, 2022
  • Python Modules
Python Selenium Introduction and Setup

The purpose of this tutorial is to introduce you to Selenium and show the process of installing selenium and webdriver for browser automation. In this article, we’ve assumed that you already have python installed on your machine.

It’s an important point to note that Browser automation and Web Scrapping are completely White Hat in their approach and the Web Browsers themselves support it officially, provide web drivers for automation and testing, just the browser window opened using code is labeled as “this browser is being controlled by automated test software”

What is Selenium?

Selenium is an open-source project which provides a wide range of tools to automate the web browser. It is also used to create web scrapers to obtain(scrape) desired data from web pages.

Some tasks that can be done using Python Selenium are:

  • Automating Browser tasks such as login, meeting join, scrolling, surfing, etc.
  • Getting Data from Website/webpage in text, excel file, code, etc.

A crucial component in browser automation is a Webdriver. A Webdriver is a collection of APIs which makes interaction with the browser easy. Combining Selenium and webdriver make it very easy to automate boring tasks of the web.

Installing Selenium

To start with setting up our computer for browser automation and web scraping, we need to start with the installation of some tools and libraries.

1. Install Selenium

First we’ll install the selenium package using pip. It is very easy to install any python package using the pip install package_name command.

Open the command prompt of your computer and enter the below command. You can also run the command in the terminal of your system or IDE.

pip install selenium

It will install the latest version of selenium on our machine.

2. Install the Selenium Webdriver

Our second task, in setting up is to install the webdriver as per our browser, which we intend to use to automate.

While installing the webdriver we need to make sure that it has the same version as our Web Browser. Every browser has its own webdriver which is maintained by its parent companies.

Below are the links for downloading webdriver of the popular Web Browers – Mozilla Firefox, Google Chrome, and Microsoft Edge respectively.

To download Mozilla Firefox Webdriver: here
To download Google Chrome Webdriver: here
To download Microsoft Webdriver: here

After downloading selenium and the required webdriver, you are ready to write python scripts to automate the web browser.

3. Importing Selenium in Python

As we have downloaded the required tools and libraries, as a final step we need to import the required as follow:

Note: We need to pass the location (as saved on our computer) of the installed web driver file to the webdriver method.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome('C://software/chromedriver.exe')

Tip: Instead, of passing the location as a parameter every time, in every code, we can skip this step in a smart way by declaring (saving) the location of the downloaded web driver file as an environment variable.

Recommended Reads for Selenium

Finally, we are done with the setup and you may start web scraping and automating your web browser tasks by following our tutorials on Python Selenium –

  • Open Web Page URLs using Python Selenium
  • Fetch data from a web page
  • Fetch Stock Market data using Selenium
Pranjal Srivastava
Pranjal Srivastava

Student | Developer | Programmer

Articles: 25
How To Fetch Stock Market Data Using Selenium Python
Previous Post How To Fetch Stock Market Data Using Selenium Python
Next Post How to open Webpage URLs in Selenium
How to open Webpage URLs in Selenium

Related Posts

np.linalg.eig: Eigenvalues and Eigenvectors

np.linalg.eig: Eigenvalues and Eigenvectors

  • November 30, 2026
np.sin() in NumPy: Radians, Arrays, and Examples

How to Use np.sin() in NumPy

  • November 30, 2026
cv2.imread: Load Images with OpenCV

cv2.imread: Load Images with OpenCV

  • November 30, 2026

Partner Websites

  • GoLangDocs
  • LinuxForDevices
  • CodeForGeek

Popular Categories

  • Python Programming
  • Python Modules
  • OOPS in Python
  • Python Programming Examples
  • Strings in Python

Hall of Fame

  • Python Programming
  • OOPS in Python
  • Creating Python Modules
  • Args and Kwargs in Python
  • Python Dictionary (Dict) Tutorial
  • Python List – 15 Things You MUST Know
  • Python Set – Things You MUST Know
  • Python String Functions: Methods by Task

Important Links

  • Home
  • Python Course
  • Start Here
  • Blog
  • About AskPython
Latest posts
  • np.linalg.eig: Eigenvalues and Eigenvectors
  • What Does %s Mean in a Python Format String?
  • How to Use np.sin() in NumPy
  • cv2.imread: Load Images with OpenCV
  • pd.read_json: Read JSON Into a DataFrame

Copyright © 2026 - AskPython. All rights reserved.