Q1.Explain difference between selenium IDE, Selenium WebDriver and Selenium Grid?
ANS: Selenium IDE allows us to record, playback the recording, edit, and debug our test. Selenium WebDriver is an API that executes our test by driving a browser for
automating an Application Under Test (AUT). Selenium Grid executes our test across multiple browsers, operating systems, and machines.
Q2.Write a selenium scripts in java to open Google and selenium browser Driver
package com.Task15.Answers;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class Q2Launch_browser {
public static void main(String[] args) {
WebDriver driver =new ChromeDriver();
driver.get("https://www.google.com/");
WebElement Q= driver.findElement(By.id("APjFqb"));
Q.sendKeys("Selenium Browser Driver");
Q.sendKeys(Keys.ENTER);
}
}
Q3.what is selenium, how it is helpful in Automation Testing ?
Ans:
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 application can't be tested. However, other tools like Appium and HP's QTP can be used to test software and mobile applications.
Q4.What all Browser driver are used in Selenium?
Ans:
It supports a number of browsers (Google Chrome 12+, Internet Explorer 7,8,9,10, Safari 5.1+, Opera 11.5, Firefox 3+) and operating systems (Windows, Mac, Linux/Unix). Selenium also provides compatibility with different programming languages – C#, Java, JavaScript, Ruby,
Python, PHP.
Q5.What are steps to create Simple Webdriver script? Explain with code
Ans:
Basic Steps in a Selenium WebDriver Script:
Step 1 Create a WebDriver instance.
Step 2: Navigate to a webpage.
Step 3: Locate a web element on the webpage via locators in selenium.
Step 4: Perform one or more user actions on the element.
Step 5: Preload the expected output/browser response to the action.
Step 6 : Run test.
Step 7: Record results and compare results from them to the expected output.
Code:
public class Q2Launch_browser {
public static void main(String[] args) {
WebDriver driver =new ChromeDriver(); //Create a WebDriver instance.
driver.get("https://www.google.com/"); // Navigate to a webpage.
WebElement Q= driver.findElement(By.id("APjFqb"));// Locate a web element on the webpage via locators in selenium.
Q.sendKeys("Selenium Browser Driver");
Q.sendKeys(Keys.ENTER); //Perform one or more user actions on the element.
}
}
Top comments (0)