Automation Testing (task 15)

1.Explain the difference between Selenium IDE, Selenium WebDriver, and Selenium Grid ?

Selenium IDE :

Selenium IDE (Integrated Development Environment) is primarily a record/run tool that a test case developer uses to develop Selenium Test cases. Selenium IDE is an easy-to-use tool from the Selenium Test Suite and can even be used by someone new to developing automated test cases for their web applications.

Selenium WebDriver :

Selenium WebDriver is a collection of open source APIs which are used to automate the testing of a web application. Description: Selenium WebDriver tool is used to automate web application testing to verify that it works as expected. It supports many browsers such as Firefox, Chrome, IE, and Safari.

Selenium Grid :

Selenium Grid is a smart proxy server that makes it easy to run tests in parallel on multiple machines. This is done by routing commands to remote web browser instances, where one server acts as the hub. This hub routes test commands that are in JSON format to multiple registered Grid nodes.

Selenium WebDriver is a code library of APIs for controlling browsers. In comparison, Selenium IDE is a browser plug-in designed for recording and playing back tests. Both client toolsets are open-source and used with great frequency, together or apart

Selenium IDE is for less-technical testers to create a visual, grid-like example of what they want to test. WebDriver should be used for more complex tests that need to loop, perform setup or interact with external systems.

2.Write a Selenium Script in Java to open Google and Search for "Selenium Browser Driver ".

package seldemo;

import org.openqa.selenium.By;

import org.openqa.selenium.Keys;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

import io.github.bonigarcia.wdm.WebDriverManager;

public class SeleniumScript {

public static void main(String[] args) {

WebDriverManager.firefoxdriver().setup();

WebDriver driver = new FirefoxDriver();

driver.get("https://www.google.co.in/"); driver.findElement(By.id("APjFqb")).sendKeys("Selenium Browser Driver"+ Keys.ENTER);

}

}

3.What is Selenium ? How it is useful in Automation Testing ?

Selenium is an open source web browser automation framework. It's a combination of several different tools - the Selenium IDE, Selenium WebDriver, Selenium RC, and Selenium Grid.

Selenium is a tool for automating testing across many web browsers. Selenium WebDriver supports a variety of browsers, including Google Chrome, Mozilla Firefox, Safari, and Internet Explorer, and allows you to simply automate browser testing across different browsers.

Selenium is an open-source, automated testing tool used to test web applications across various browsers. Selenium can only test web applications, unfortunately, so desktop and mobile apps can't be tested. However, other tools like Appium and HP's QTP can be used to test software and mobile applications .

4.What are all Browser driven used in Selenium ?

Selenium WebDriver is a collection of open source APIs which are used to automate the testing of a web application. Description: Selenium WebDriver tool is used to automate web application testing to verify that it works as expected. It supports many browsers such as Firefox, Chrome, IE, and Safari.

Selenium WebDriver supports variable browsers drivers, including

ChromeDriver: For Google Chrome

GeckoDriver: For Mozilla Firefox

EdgeDriver: For Microsoft Edge

SafariDriver: For Apple Safari

OperaDriver: For Opera Browser

5.What Are The Steps To Create A Simple Web Driver Script?Explain with code.

Step 1: Set up your development environment by downloading the required WebDriver executable (e.g., ChromeDriver) and configuring your project.

Step 2: Create a new Java class for your script (e.g., GoogleSearch.java). Step 3: Write the script using WebDriver commands to automate browser interactions.

Step 4: Run the script to execute the automation. I've already provided an example script in question 2 that opens Google and searches for "Selenium Browser Driver."

Coding :

package seldemo;

import org.openqa.selenium.By;

import org.openqa.selenium.Keys;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

import io.github.bonigarcia.wdm.WebDriverManager;

public class SeleniumScript {

public static void main(String[] args) {

WebDriverManager.firefoxdriver().setup();

WebDriver driver = new FirefoxDriver();

driver.get("https://www.google.co.in/"); driver.findElement(By.id("APjFqb")).sendKeys("Selenium Browser Driver"+ Keys.ENTER);

}

}