Package jp.vmi.selenium.selenese.locator
Class WebDriverElementFinder
- java.lang.Object
-
- jp.vmi.selenium.selenese.locator.WebDriverElementFinder
-
public class WebDriverElementFinder extends Object
WebDriver Element Locator. Fully override the implementation of original ElementFinder. Note: This does not support ui locator.- @see SeleniumIDE Reference
- @see UI document
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWebDriverElementFinder.ElementFinderNoSuchElementExceptionNoSuchElementException for WebDriverElementFinder.
-
Constructor Summary
Constructors Constructor Description WebDriverElementFinder()Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidadd(String strategyName, String implementation)Add user defined handler of element finder.static StringconvertToOptionLocatorWithParent(String parentLocator, String optionLocator)Deprecated.org.openqa.selenium.WebElementfindElement(org.openqa.selenium.WebDriver driver, String locator)Find an element.org.openqa.selenium.WebElementfindElement(org.openqa.selenium.WebDriver driver, Locator ploc)Find an element.org.openqa.selenium.WebElementfindElement(org.openqa.selenium.WebDriver driver, Locator ploc, List<Locator> selectedFrameLocators)Find an element of specified locator.List<org.openqa.selenium.WebElement>findElements(org.openqa.selenium.WebDriver driver, String locator)Find elements of specified locator.List<org.openqa.selenium.WebElement>findElements(org.openqa.selenium.WebDriver driver, Locator ploc)Find elements of specified locator.List<org.openqa.selenium.WebElement>findElements(org.openqa.selenium.WebDriver driver, Locator ploc, List<Locator> selectedFrameLocators)Find elements of specified locator.org.openqa.selenium.WebElementfindElementWithTimeout(org.openqa.selenium.WebDriver driver, String locator, boolean isRetryable, int timeout)Find an element.org.openqa.selenium.WebElementfindElementWithTimeout(org.openqa.selenium.WebDriver driver, Locator ploc, boolean isRetryable, int timeout)Find an element.List<org.openqa.selenium.WebElement>findOptions(org.openqa.selenium.WebElement element, OptionLocator poptloc)Find "option" elements of specified option locator.List<Locator>getCurrentFrameLocators()Get copy of current frame locators.OptionLocatorHandlergetOptionHandler(OptionLocator poptloc)Get option locator handler.WebDriverElementFinderregisterHandler(LocatorHandler handler)Register locator handler.WebDriverElementFinderregisterOptionHandler(OptionLocatorHandler handler)Register option locator handler.voidselectFrame(org.openqa.selenium.WebDriver driver, String locator)Select frame or iframe.voidselectFrame(org.openqa.selenium.WebDriver driver, Locator ploc)Select frame or iframe.
-
-
-
Method Detail
-
convertToOptionLocatorWithParent
@Deprecated public static String convertToOptionLocatorWithParent(String parentLocator, String optionLocator)
Deprecated.Convert to option locator with parent.- Parameters:
parentLocator- parent locator.optionLocator- child option locator.- Returns:
- option locator with parent.
-
registerHandler
public WebDriverElementFinder registerHandler(LocatorHandler handler)
Register locator handler.- Parameters:
handler- locator handler.- Returns:
- this.
-
registerOptionHandler
public WebDriverElementFinder registerOptionHandler(OptionLocatorHandler handler)
Register option locator handler.- Parameters:
handler- option locator handler.- Returns:
- this.
-
getOptionHandler
public OptionLocatorHandler getOptionHandler(OptionLocator poptloc)
Get option locator handler.- Parameters:
poptloc- option locator.- Returns:
- option locator handler.
-
add
public void add(String strategyName, String implementation)
Add user defined handler of element finder.- Parameters:
strategyName- strategy name.implementation- JavaScript code.
-
findOptions
public List<org.openqa.selenium.WebElement> findOptions(org.openqa.selenium.WebElement element, OptionLocator poptloc)
Find "option" elements of specified option locator.- Parameters:
element- "select" element.poptloc- parsed option locator.- Returns:
- list of found "option" elements.
-
findElements
public List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.WebDriver driver, Locator ploc, List<Locator> selectedFrameLocators)
Find elements of specified locator.- Parameters:
driver- WebDriver.ploc- parsed locator.selectedFrameLocators- selected frame locators.- Returns:
- list of found elements. (empty if no element)
-
findElements
public List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.WebDriver driver, Locator ploc)
Find elements of specified locator.- Parameters:
driver- WebDriver.ploc- parsed locator.- Returns:
- list of found elements. (empty if no element)
-
findElements
public List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.WebDriver driver, String locator)
Find elements of specified locator.- Parameters:
driver- WebDriver.locator- locator.- Returns:
- list of found elements. (empty if no element)
-
findElement
public org.openqa.selenium.WebElement findElement(org.openqa.selenium.WebDriver driver, Locator ploc, List<Locator> selectedFrameLocators)Find an element of specified locator.- Parameters:
driver- WebDriver.ploc- parsed locator.selectedFrameLocators- selected frame locators.- Returns:
- found element.
- Throws:
WebDriverElementFinder.ElementFinderNoSuchElementException- throw if element not found.
-
findElement
public org.openqa.selenium.WebElement findElement(org.openqa.selenium.WebDriver driver, Locator ploc)Find an element.- Parameters:
driver- WebDriver.ploc- parsed locator.- Returns:
- found element.
- Throws:
WebDriverElementFinder.ElementFinderNoSuchElementException- throw if element not found.
-
findElement
public org.openqa.selenium.WebElement findElement(org.openqa.selenium.WebDriver driver, String locator)Find an element.- Parameters:
driver- WebDriver.locator- locator.- Returns:
- found element.
- Throws:
WebDriverElementFinder.ElementFinderNoSuchElementException- throw if element not found.
-
findElementWithTimeout
public org.openqa.selenium.WebElement findElementWithTimeout(org.openqa.selenium.WebDriver driver, Locator ploc, boolean isRetryable, int timeout)Find an element.- Parameters:
driver- WebDriver.ploc- parsed locator.isRetryable- retry finding an element. If false, this is the same asfindElement(WebDriver, Locator).timeout- timeout (ms).- Returns:
- found element.
- Throws:
WebDriverElementFinder.ElementFinderNoSuchElementException- throw if element not found.
-
findElementWithTimeout
public org.openqa.selenium.WebElement findElementWithTimeout(org.openqa.selenium.WebDriver driver, String locator, boolean isRetryable, int timeout)Find an element.- Parameters:
driver- WebDriver.locator- locator.isRetryable- retry finding an element. If false, this is the same asfindElement(WebDriver, Locator).timeout- timeout (ms).- Returns:
- found element.
- Throws:
WebDriverElementFinder.ElementFinderNoSuchElementException- throw if element not found.
-
selectFrame
public void selectFrame(org.openqa.selenium.WebDriver driver, Locator ploc)Select frame or iframe.- Parameters:
driver- WebDriver.ploc- parsed locator to frame/iframe.- Throws:
org.openqa.selenium.NoSuchFrameException- If the frame cannot be found
-
selectFrame
public void selectFrame(org.openqa.selenium.WebDriver driver, String locator)Select frame or iframe.- Parameters:
driver- WebDriver.locator- locator to frame/iframe.
-
-