Package org.openqa.selenium.htmlunit
Class HtmlUnitElementFinder.FindByID
java.lang.Object
org.openqa.selenium.htmlunit.HtmlUnitElementFinder.HtmlUnitElementLocator
org.openqa.selenium.htmlunit.HtmlUnitElementFinder.FindByID
- Enclosing class:
- HtmlUnitElementFinder
public static class HtmlUnitElementFinder.FindByID
extends HtmlUnitElementFinder.HtmlUnitElementLocator
Locator strategy for finding elements by their
id attribute.
Supports searching both on the HtmlUnitDriver page and within a
HtmlUnitWebElement context.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.openqa.selenium.WebElementfindElement(HtmlUnitDriver driver, org.openqa.selenium.By locator) Finds a single element on the given page using the provided locator.org.openqa.selenium.WebElementfindElement(HtmlUnitWebElement element, org.openqa.selenium.By locator) Finds a single element within a specificHtmlUnitWebElement.List<org.openqa.selenium.WebElement>findElements(HtmlUnitDriver driver, org.openqa.selenium.By locator) Finds multiple elements on the given page using the provided locator.List<org.openqa.selenium.WebElement>findElements(HtmlUnitWebElement element, org.openqa.selenium.By locator) Finds multiple elements within a specificHtmlUnitWebElement.Methods inherited from class org.openqa.selenium.htmlunit.HtmlUnitElementFinder.HtmlUnitElementLocator
getLastPage, getRemotable, getValue
-
Constructor Details
-
FindByID
public FindByID()
-
-
Method Details
-
findElement
public org.openqa.selenium.WebElement findElement(HtmlUnitDriver driver, org.openqa.selenium.By locator) Description copied from class:HtmlUnitElementFinder.HtmlUnitElementLocatorFinds a single element on the given page using the provided locator.If multiple elements match, only the first is returned. If no element is found, a
NoSuchElementExceptionis thrown.- Overrides:
findElementin classHtmlUnitElementFinder.HtmlUnitElementLocator- Parameters:
driver- the driver representing the browser/page contextlocator- the locator strategy to use- Returns:
- the first matching
WebElement
-
findElements
public List<org.openqa.selenium.WebElement> findElements(HtmlUnitDriver driver, org.openqa.selenium.By locator) Description copied from class:HtmlUnitElementFinder.HtmlUnitElementLocatorFinds multiple elements on the given page using the provided locator.- Specified by:
findElementsin classHtmlUnitElementFinder.HtmlUnitElementLocator- Parameters:
driver- the driver representing the browser/page contextlocator- the locator strategy to use- Returns:
- a list of matching
WebElementobjects
-
findElement
public org.openqa.selenium.WebElement findElement(HtmlUnitWebElement element, org.openqa.selenium.By locator) Description copied from class:HtmlUnitElementFinder.HtmlUnitElementLocatorFinds a single element within a specificHtmlUnitWebElement.If multiple elements match, only the first is returned. If no element is found, a
NoSuchElementExceptionis thrown.- Overrides:
findElementin classHtmlUnitElementFinder.HtmlUnitElementLocator- Parameters:
element- the element within which to searchlocator- the locator strategy to use- Returns:
- the first matching
WebElement
-
findElements
public List<org.openqa.selenium.WebElement> findElements(HtmlUnitWebElement element, org.openqa.selenium.By locator) Description copied from class:HtmlUnitElementFinder.HtmlUnitElementLocatorFinds multiple elements within a specificHtmlUnitWebElement.- Specified by:
findElementsin classHtmlUnitElementFinder.HtmlUnitElementLocator- Parameters:
element- the element within which to searchlocator- the locator strategy to use- Returns:
- a list of matching
WebElementobjects
-