Package uk.co.evoco.webdriver.utils
Class FindByUtils
- java.lang.Object
-
- uk.co.evoco.webdriver.utils.FindByUtils
-
public final class FindByUtils extends Object
Utilities class providing support methods for locating elements in more dynamic ways than the standard out of the box location methods provided by Selenium
-
-
Constructor Summary
Constructors Constructor Description FindByUtils()
-
Method Summary
Modifier and Type Method Description static org.openqa.selenium.WebElement
byIdOrName(org.openqa.selenium.WebDriver webDriver, String idOrName)
Finds elements by either the HTML name or id attribute using the given selector textstatic org.openqa.selenium.WebElement
multipleLocatorMatchGetDisplayed(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.By locator)
Finds the first element that is displayed with given locator.
-
-
-
Method Detail
-
multipleLocatorMatchGetDisplayed
public static org.openqa.selenium.WebElement multipleLocatorMatchGetDisplayed(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.By locator) throws org.openqa.selenium.WebDriverException
Finds the first element that is displayed with given locator. Useful for instances where there are multiple elements on the DOM with the same locator and one (or more) of them are hidden (e.g. used in mobile layouts or hold a different z-index given some other element is present)- Parameters:
webDriver
- active WebDriver instancelocator
- selector for target WebElement- Returns:
- active WebElement, already located
- Throws:
org.openqa.selenium.WebDriverException
-
byIdOrName
public static org.openqa.selenium.WebElement byIdOrName(org.openqa.selenium.WebDriver webDriver, String idOrName)
Finds elements by either the HTML name or id attribute using the given selector text- Parameters:
webDriver
- active WebDriver instanceidOrName
- the variable locator- Returns:
- active WebElement, already located
-
-