Task 15 - Automation Testing

·

2 min read

Difference between IDE, Webdriver and Grid.

  • Selenium IDE

Selenium IDE (Integrated Development Environment) is primarily a record/run tool. It is an Add-on or an extension available for both Firefox and Chrome that generates tests quickly through its functionality of record and playback. You don’t need to learn any test scripting language for authoring any functional tests.

  • Selenium WebDriver

Selenium WebDriver is an enhanced version of Selenium RC. It was introduced in the market to overcome the limitation faced in Selenium RC. Though it is an advanced version of RC, its architecture is completely different from that of RC. Just like Selenium RC, Selenium WebDriver too supports multiple programming platforms to provide wider flexibility and requires knowing any one programming language.

  • Selenium Grid

Selenium Grid is a tool that is used for concurrent execution of test cases on different browsers, machines, and operating systems simultaneously. This tool makes Cross-browser compatibility testing very easy. There are two versions of the Selenium Grid – the older version is known as Grid 1 and the recent version is known as Grid 2..

Selenium script in Java to open Google and search for Selenium Browser driver

package learning.selenium;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

import io.github.bonigarcia.wdm.WebDriverManager;

public class GoogleSearch {

public static void main(String[] args) {

WebDriverManager.chromedriver().setup();

WebDriver driver;

driver = new ChromeDriver();

driver.get("https://www.google.com/");

driver.findElement(By.name("q")).sendKeys("Selenium Browser driver \n");

}

}

What is selenium . How is useful in automation testing?

Selenium is a popular tool for automated testing that can increase the accuracy and reliability of your tests1. The benefits of using Selenium for test automation are immense. Here are some of the advantages of using Selenium for automated testing:

  • Open source availability

  • Ease of implementation

  • Language and framework support

  • Multi-browser support

  • Support across various operating systems

Browser Drivers supported by selenium

  • chrome driver

  • IE driver

  • firefox driver

  • safari driver.

Steps to create simple webdriver script with example

Basic Steps in a Selenium WebDriver Script

  • Create a WebDriver instance.

  • Navigate to a webpage.

  • Locate a web element on the webpage via locators in selenium.

  • Perform one or more user actions on the element.

  • Preload the expected output/browser response to the action.

sample code

package learning.selenium;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

import io.github.bonigarcia.wdm.WebDriverManager;

public class GoogleSearch {

public static void main(String[] args) {

WebDriverManager.chromedriver().setup();

WebDriver driver;

driver = new ChromeDriver();

driver.get("https://www.google.com/");

driver.findElement(By.name("q")).sendKeys("Selenium Browser driver \n");

}

}