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

Holmos.webtest.element.locator.LocatorFinder Maven / Gradle / Ivy

There is a newer version: 1.0.2u10
Show newest version
package Holmos.webtest.element.locator;

import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
/**
 * @author 吴银龙(15857164387)*/
public class LocatorFinder {
	private WebDriver driver;
	private WebElement element;
	private boolean isElementFinder;
	public LocatorFinder(Object locatorFinder){
		if(locatorFinder instanceof WebDriver){
			this.driver=(WebDriver) locatorFinder;
			this.isElementFinder=false;
		}
		else if(locatorFinder instanceof WebElement){
			this.element=(WebElement) locatorFinder;
			this.isElementFinder=true;
		}	
	}
	public WebElement findElement(By by){
		if(this.isElementFinder){
			return element.findElement(by);
		}else
			return driver.findElement(by);
	}
	public List findElements(By by){
		if(this.isElementFinder){
			return element.findElements(by);
		}else
			return driver.findElements(by);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy