All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.framework.utils.Waiting Maven / Gradle / Ivy

Go to download

A jar to include in your test setup that drives the cucumber jvm tests. Facilitates in executing the cucumber tests in parallel. Contains libraries such as to read from Excel, random generator etc.

The newest version!
package org.framework.utils;

import java.util.List;

import org.framework.controller.MainController;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

/*
 * @author Hemanth.Sridhar
 */
public class Waiting {

	WebDriver driver;
	public Waiting(WebDriver driver)
	{
		this.driver = driver;
	}

	public void explicitWaitElementToBeClickable(WebElement element, int time){
		MainController main = new MainController();
		new WebDriverWait(driver, time).until(ExpectedConditions.elementToBeClickable(element));
	}
	
	public   void explicitWaitElementToBeClickable(By element, int time){
		MainController main = new MainController();
		new WebDriverWait(driver, time).until(ExpectedConditions.elementToBeClickable(element));
	}
	
	public   void explicitWaitElementToBeSelected(WebElement element, int time){
		MainController main = new MainController();
		
		new WebDriverWait(driver, time).until(ExpectedConditions.elementToBeSelected(element));
	}
	
	public   void explicitWaitElementToBeSelected(By element, int time){
		MainController main = new MainController();
		new WebDriverWait(driver, time).until(ExpectedConditions.elementToBeSelected(element));
	}
	
	public   void explicitWaitTextToBePresentInElement(WebElement element, int time,String text){
		MainController main = new MainController();
		new WebDriverWait(driver, time).until(ExpectedConditions.textToBePresentInElement(element, text));
	}
	
	
	public   void explicitWaitTitleContains(WebElement element, int time,String title){
		MainController main = new MainController();
		new WebDriverWait(driver, time).until(ExpectedConditions.titleContains(title));
	}
	
	public   void explicitWaitTitleContains(By element, int time,String title){
		MainController main = new MainController();
		new WebDriverWait(driver, time).until(ExpectedConditions.titleContains(title));
	}
	
	
	public   void explicitWaitTitleIs(WebElement element, int time,String title){
		MainController main = new MainController();
		new WebDriverWait(driver, time).until(ExpectedConditions.titleIs(title));
	}
	

	public   void explicitWaitTitleIs(By element, int time,String title){
		MainController main = new MainController();
		new WebDriverWait(driver, time).until(ExpectedConditions.titleIs(title));
	}
	
	public   void explicitWaitVisibilityOfElement(WebElement element, int time){
		MainController main = new MainController();
		new WebDriverWait(driver, time).until(ExpectedConditions.visibilityOf(element));
	}
	
	public   void explicitWaitVisibilityOfElement(By element, int time){
		MainController main = new MainController();
		new WebDriverWait(driver, time).until(ExpectedConditions.visibilityOfElementLocated(element));
	}
	
	public   void explicitWaitSelectionStateToBe(WebElement element, int time,boolean selected){
		MainController main = new MainController();
		new WebDriverWait(driver, time).until(ExpectedConditions.elementSelectionStateToBe(element, selected));
	}
	
	
	public   void explicitWaitSelectionStateToBe(By element, int time,boolean selected){
		MainController main = new MainController();
		new WebDriverWait(driver, time).until(ExpectedConditions.elementSelectionStateToBe(element, selected));
	}
	
	public   void explicitWaitForAlert(int time){
		MainController main = new MainController();
		new WebDriverWait(driver, time).until(ExpectedConditions.alertIsPresent());
	}

	public   void explicitWaitVisibilityOfElements(List element, int time) {
		MainController main = new MainController();
		new WebDriverWait(driver,time).until(ExpectedConditions.visibilityOfAllElements(element));
	}
	
public   void explicitWaitVisibilityOfElements(By element, int time) {
	MainController main = new MainController();
		new WebDriverWait(driver,time).until(ExpectedConditions.visibilityOfAllElementsLocatedBy(element));
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy