Browser Automation with Python and Selenium — 2: Getting Started
A simple example to start
In the previous post, we looked at the required installations to start writing our automation scripts.
Getting Started with WebDriver
As stated in the official documentation
“WebDriver is an API and protocol that defines a language-neutral interface for controlling the behaviour of web browsers.”
Each browser is backed by a specific WebDriver implementation, called a driver. The driver takes commands from the client-side and delegates them to the browser and handles communication between Selenium and the browser.
Through WebDriver, Selenium supports all major browsers such as Chrome, Firefox, Edge, Internet Explorer, Opera, and Safari. WebDriver aims to emulate a real user’s interaction with the browser as closely as possible.
A Very Simple Example
If you have installed Selenium Python bindings, you can start to use webdriver api.
If you don’t, create a virtual environment in your working directory, and install the selenium
package.
python -m venv env
source env/bin/activate
pip install selenium