This repository contains generic functions used in selenium java
π Click this link to view JavaScriptExecutor methods
π Click this link to view Excel Operation using Apache POI
π Click this link to view Extent Reports in Selenium WebDriver
π Click this link to view Access data from Properties File
π Click this link to view Common methods used in selenium webdriver
π Click this link to view Sample selenium programs
π Click this link to view Sample TestNG programs
π Click this link to view Advance selenium concepts
π Click this link to view Jenkins concepts
π Click this link to view Java TitBits
π Click this link to view Java Programs
π Click this link to view Debugging
π Click this link to view Accessibility Testing
π Click this link to view Linux Commands
Most of the web applications are developed using Ajax and Javascript. When a page is loaded by the browser the elements which we want to interact with may load at different time intervals.
Selenium Wait
Wait commands
Handle Ajax call Using JavaScriptExecutor
Action Class in Selenium is a built-in feature provided by the selenium for handling keyboard and mouse events. It includes various operations such as multiple events clicking by control key, drag and drop events and many more. These operations from the action class are performed using the advanced user interaction API in Selenium Webdriver.
How to use Action Class
Selenium scripts use Robot class for automating the browser and desktop pop-ups, but the exciting thing is this class is not part of org.openqa.selenium package of Web Driver API.
Then from where does this class come?
It doesnβt reside in Web Driver API; it is part of the Java API awt package
How to use Robot Class
Winium is a Selenium-based tool for testing and automating desktop applications on a Windows desktop. It uses selenium-based libraries however the community has made only two releases and there is no active work or maintenance since then
Winium sample code snippet
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.winium.DesktopOptions;
import org.openqa.selenium.winium.WiniumDriver;
import java.net.MalformedURLException;
import java.net.URL;
public class sampleTest {
public static void main(String[] args) throws MalformedURLException, InterruptedException {
WiniumDriver driver = null;
String appPath = "C:/windows/system32/calc.exe";
DesktopOptions option = new DesktopOptions();
option.setApplicationPath(appPath);
option.setDebugConnectToRunningApp(false);
option.setLaunchDelay(2);
driver = new WiniumDriver(new URL("http://localhost:9999"),option);
Thread.sleep(1000);
WebElement window = driver.findElementByClassName("CalcFrame");
WebElement menuItem = window.findElement(By.id("MenuBar")).findElement(By.name("View"));
menuItem.click();
driver.findElementByName("Scientific").click();
window.findElement(By.id("MenuBar")).findElement(By.name("View")).click();
driver.findElementByName("History").click();
window.findElement(By.id("MenuBar")).findElement(By.name("View")).click();
driver.findElementByName("History").click();
window.findElement(By.id("MenuBar")).findElement(By.name("View")).click();
driver.findElementByName("Standard").click();
driver.findElementByName("4").click();
driver.findElementByName("Add").click();
driver.findElementByName("5").click();
driver.findElementByName("Equals").click();
driver.close();
}
}
WinAppDriver uses selenium-like libraries and is actively supported by the community and is developed by the makers of Windows OS β Microsoft. Windows Application Driver supports Selenium-like UI test automation for Windows applications. The service supports automated testing of Universal Windows Platform (UWP), Windows Forms (WinForms), Windows Presentation Foundation (WPF), and Classic Windows (Win32) apps on the Windows 10 operating system. Winappdriver complies with the JSON Wire Protocol and some application management functionalities defined by Appium. This service provides better support for using Appium to test Windows Applications.
WinAppDriver with Java
WinAppDriver with C#
HTML unit driver
Maven build life cycles are listed below as the followings:
- Clean: Removes the artifact produced from the preceding build processes.
- Default: Deployment and build process is taken care of.
- Site: Project documentation is carried out in this cycle.
Maven-interview-questions
Maven-interview-questions
Maven-interview-questions
Maven-POM.xml
Maven Surefire Plugin
When we execute Maven build commands, Maven starts looking for dependency libraries in the following sequence β
- Step 1 β Search dependency in local repository(.m2), if not found, move to step 2.
- Step 2 β Search dependency in central repository(https://mvnrepository.com), if not found and remote repository/repositories is/are mentioned then move to step 4. Else it is downloaded to local repository for future reference.
- Step 3 β If a remote repository has not been mentioned, Maven simply stops the processing and throws error (Unable to find dependency).
- Step 4 β Search dependency in remote repository or repositories, if found then it is downloaded to local repository for future reference. Otherwise, Maven stops processing and throws error (Unable to find dependency).
Selenium Webdriver Interface & Classes Hierarchy
Hierarchy Of Classes & Interfaces Of WebDriver Interface In Selenium WebDriver
Upcasting & downcasting Classes
Why Should We Upcast Browser Driver Class Object To WebDriver?
// Running javascript command
// Need to downcast to JavascriptExecutor
WebDriverManager.chromedriver().setup();
WebDriver driver = new ChromeDriver();
JavascriptExecutor jse = (JavascriptExecutor) driver;
jse.executeScript("window.scrollBy(0,250)");
or
ChromeDriver driver = new ChromeDriver();
driver.executeScript("window.scrollBy(0,250)");
Architecture Of Selenium
selenium < 3.8 -Json wire protocol
selenium > 3.8 -W3C Protocol
http://makeseleniumeasy.com/home/seleniumbytopic/