Python Selenium Introduction & Installation

This is our first article with video training on Python Selenium, in this article we are going to talk about Introduction & Installation of Selenium. we are going to install web drivers of selenium for Google Chrome and Mozila Firefox.

 

 

What is Selenium ?

Selenium is a set of tools for browser automation, and it is mostly used for testing applications. but the usage of selenium is not limited to testing of applications, but it can also be used for screen scrapping and repetitive tasks automation in a browser.  so selenium supports automation for different browsers like firefox, internet explorer, google chrome, safari  and opera.

 

There are different tools of selenium that you can use

 

  • Selenium IDE: This is a Firefox add-in used to record and play back the
    Selenium scripts with Firefox. It provides a graphical user interface to
    record user actions using Firefox.
  • Selenium Web Driver: This is programming interface, and it is used with programming languages like Java,Python,C#, Ruby, PHP and JavaScript. and the web drivers supports different browsers like, Google Chrom, Mozila Firefox, Internet Explorer, Opera and Safari.
  • Selenium Stand Alone Server: This is also known as Selenium Grid and  allows remote and distrbuted execution of Selenium scripts created with WebDriver.

 

What is Python Selenium ?

Selenium Python bindings provides a simple API to write functional/acceptance tests using Selenium WebDriver. Through Selenium Python API you can access all functionalities of Selenium WebDriver in an intuitive way. Selenium Python bindings provide a convenient API to access Selenium WebDrivers like Firefox, Ie, Chrome, Remote etc. The current supported Python versions are 2.7, 3.5 and above.

 

 

Installation 

You can install python selenium via pip like this.

 

 

Drivers

Selenium requires a driver to interface with the chosen browser, and there are different driver for each browsers that you need to download, it is just an exe file, after downloading just copy and paste the driver where you have installed your python. these are the most popular drivers download link for different browsers.

Chrome: https://sites.google.com/a/chromium.org/chromedriver/downloads
Edge: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
Firefox: https://github.com/mozilla/geckodriver/releases
Safari: https://webkit.org/blog/6900/webdriver-support-in-safari-10/

 

 

 

First of all you need to import web driver from selenium

 

 

 

 

these line of codes are for opening of the chosen browser, for example in here we have used Google Chrome and Mozila Firefox.

 

 

 

In here you can open a specific website

 

 

 

These are some web properties for the driver, like printing the title of the web page, current url and page source.

 

 

 

And these are some web browser commands, for example you can set the screen of the browser and also x and y position of the browser.

 

 

 

This is used for closing of the browser, after the loading is completed.

 

 

 

 

Also you can watch the complete video  for Python Selenium Introduction & Installation

 

 

 

 

 

Subscribe and Get Free Video Courses & Articles in your Email

 

Share via
Copy link
Powered by Social Snap
×