Selenium

Why Selenium is Most Widely Used Test Automation Tool?

  • Platform Independent: Avoids the software tester’s time in writing test scripts for each platform to be tested. As it follows the principle of writing one test script and runs on any platform.
  • Quickens TTM and TTD: In the case of manual testing, the testing is very painful and uncertain process because of which the product delivery and time to market schedules are missed. This increases the cost of overall project. However, Selenium avoids testers to write test script for each platform.
  • Fosters Continuous Integration Efforts: Continuous Integration and continuous delivery are the modern agile-enablers of the software development process.
  • Visibility in End-to-End Testing: In case of end-to-end applications testing selenium offers great visibility.
  • Reduces Turnaround Time: Selenium framework facilitates the testing teams to automatically run the multiple test cases parallelly on multi-browser platforms. This reduces the turnaround time by ensuring extreme testing quality.
  • Integration With Other Tools: Selenium with Java is famous as rest of the available jars like ExtentReports, Sikuli, Appium, and so on. Selenium tool provides flexibility for testers to get integrated with these jars to extend its functionalities to new frontiers:

Components of Selenium

Selenium IDE

Selenium IDE (Integrated Development Environment) is mainly a Firefox plugin. It is one of the simplest frameworks in the Selenium Suite. It allows us to record and playback the scripts. If you wish to create scripts using Selenium IDE, you need to use Selenium RC or Selenium WebDriver to write more advanced and robust test cases.

  1. It doesn’t extend the support to mobile-based testing like iPhone/Android testing.
  2. The execution of test cases is very slow and the report generation step is not good when compared with other components.

Selenium RC (Remote Control)

  • It is based on a client/server architecture, which implies -> whenever you want to execute the test cases/test scripts, you need to start the server manually.
  • It supports parallel execution of test cases as well as remote execution with the help of Selenium Grid.

Selenium Grid

Selenium Web Driver

Basic Commands

Below are few basic commands in selenium.

File file = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
String screenshotBase64 = ((TakesScreenshot)driver).getScreenshotAs(OutputType.BASE64);

Selenium Waits

Selenium supports two types of waits and they are as follows

  1. Explicit Wait

Implicit Waits

The Implicit wait will tell the web driver to wait for a certain amount of time before it throws a “No Such Element Exception”. The default setting of Implicit wait is zero. Once you set the time, the web driver will wait for that particular amount of time before throwing an exception.

Syntax: driver.manage().timeouts().implicitlyWait(TimeOut, TimeUnit.SECONDS);

Explicit Waits

It is a concept of the dynamic wait which waits dynamically for specific conditions. It can be implemented by WebDriverWait class. To understand the Explicit wait in Selenium Webdriver, you should know the requirement why we use wait statement in programs.

Selenium 4 new Features

Continuous Integration

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store