DEV Community

jay shankar k
jay shankar k

Posted on

SELENIUM

WHAT IS SELENIUM ?

Selenium is an open-source tool for automating web browsers. It provides a way to interact with web pages as a user would, allowing you to automate tasks, test web applications, and scrape data from websites.We use Selenium for automation because it provides a powerful way to interact with web pages programmatically.

  • Supports Cross Browser Testing.The Selenium tests can be run on multiple browsers and also supports all environment

  • Allows scripting in several languages like Java, C#, PHP and Python.

  • Open Source(Free of cost)

  • Assertion statements provide an efficient way of comparing expected and actual results.

  • Inbuilt reporting mechanism.

Through scripts to perform actions like clicking buttons, filling forms, and navigating through pages. Here's a simple example in Python:

from selenium import webdriver
Import time
#create a new instance of the crome driver 
driver=webdriver.Chrome()
#open the desired webpage
driver.get("https://www.zenclass.in/class”)

#find elements and interact with them

username_input = driver.find_element_by_id("user-name")
password_input = driver.find_element_by_id("password")
login_button = driver.find_element_by_xpath("//input[@type='submit']")

#close the browser
driver.quit() 


Enter fullscreen mode Exit fullscreen mode

In 2006 Selenium Web Driver was launched at Google.In 2008 Whole Selenium Team Decided to Merge Selenium Web Driver with Selenium RC in order to form More Powerful tool called Selenium 2.0.


Selenium IDE{Limited Use}


Selenium RC {Remote Control) Out Dated Using only for Maintenance Projects


Selenium Web Driver {Successor of Selenium RC}


Selenium Grid(Only for Parallel Test Execution, not for Test Design)

Enter fullscreen mode Exit fullscreen mode

SELENIUM IDE

  • Selenium IDE is an integrated development environment for Selenium tests.

  • It is implemented as a Firefox extension, and allows you to record, edit, and replay the test in firefox

  • Selenium IDE allows you to save tests as HTML, Java, Ruby scripts, or any other format

  • It allows you to automatically add assertions to all the pages.

  • Allows you to add selenese commands as and when required.

SELENIUM RC

Selenium RC is an important component in the Selenium test suite. It is a testing framework that enables a QA or a developer to write test cases in any programming language in order to automate UI tests for web applications against any HTTP website.

  • A server, written in Java and so available on all the platforms.

  • Acts as a proxy for web requests from them.

  • Client libraries for many popular languages.

  • Bundles Selenium Core and automatically loads into the browser

  • Once the Scripts are recorded add assertions where ever required

  • Now format the Selenese test into the language of your choice.

SELENIUM WEBDRIVER

Why selenium webdriver?

Selenium is open source software

  • We can freely download & use

  • We can do enhancements

Selenium Supports different Operating Environments

  • Ms windows

  • Linux

  • macintosh

  • Apple OX

Selenium Supports different Browser Environments

  • Google chrome

  • Linux

  • Mozilla firefox

  • IE

  • Safari

  • Opera.....

Seleniurs Suppor's different Application Environments

  • Web Based

  • Mobile Based Applications Having Web Forms

Selenium Supports different Programming Environments

  • Java

  • C#

  • Python

  • Javascript

  • Ruby

SELENIUM GRID

  • Selenium Grid is a part of the Selenium Suite

  • Selenium Grid has a Hub and Node Architecture.

  • To Run your tests against different browsers, operating systems, and machines all at the same time

  • If you set up Selenium Grid to run, say, 4 tests at a time, then you would be able to finish the whole suite around 4 times faster.

  • It support both Selenium RC and Web Driver scripts.

DISADVANTAGES WITH SELENIUM

  • It doesn't generate detailed Test Reports

  • No reliable support

  • Difficult to setup environment

  • Limited support for Image based testing

Top comments (0)