public class ByWComponentPath extends ByWComponent
This By implementation will only work if the servlet is running in the same JVM as the test. While this is the easiest way to write tests, those tests will not be reusable for verifying environments.
An implementation of By which can find HTML elements which correspond to (most) WComponents. Only WComponents which emit elements with ids can be searched on. This means that components such as WText and "WComponent" itself can not be used in a search path.
Note: Since there's no mapping from XHTML to the WComponent XML schema, this By implementation will
always search from the root component, no matter what the search context is.
See TreeUtil.findWComponents(WComponent, String[]) for details on the path syntax.
org.openqa.selenium.By.ByClassName, org.openqa.selenium.By.ByCssSelector, org.openqa.selenium.By.ById, org.openqa.selenium.By.ByLinkText, org.openqa.selenium.By.ByName, org.openqa.selenium.By.ByPartialLinkText, org.openqa.selenium.By.ByTagName, org.openqa.selenium.By.ByXPath| Constructor and Description |
|---|
ByWComponentPath(ComponentWithContext componentWithContext,
String path)
Creates a ByWComponentPath which searches for a path to a component.
|
ByWComponentPath(WComponent component,
String path)
Creates a ByWComponentPath which searches for a path to a component.
|
ByWComponentPath(WComponent component,
UIContext context,
String path)
Creates a ByWComponentPath which searches for a path to a component.
|
ByWComponentPath(WComponent component,
UIContext context,
String path,
Object value)
Creates a ByWComponentPath which searches for a path to a component.
|
| Modifier and Type | Method and Description |
|---|---|
List<org.openqa.selenium.WebElement> |
findElements(org.openqa.selenium.SearchContext searchContext) |
Class<? extends WComponent> |
getTargetWComponentClass() |
String |
toString() |
findElement, findValue, getComponent, getContext, getValue, narrowResults, setContextpublic ByWComponentPath(ComponentWithContext componentWithContext, String path)
componentWithContext - the component to search for.path - the path to traverse.public ByWComponentPath(WComponent component, String path)
component - the component instance to search for.path - the path to traverse.public ByWComponentPath(WComponent component, UIContext context, String path)
component - the component instance to search for.context - the context to search in, use null for the default context.path - the path to traverse.public ByWComponentPath(WComponent component, UIContext context, String path, Object value)
component - the component instance to search for.context - the context to search in, use null for the default context.path - the path to traverse.value - If not null, narrow the search by value for e.g. list or drop-down entries.public List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.SearchContext searchContext)
findElements in class ByWComponentpublic String toString()
toString in class ByWComponentpublic Class<? extends WComponent> getTargetWComponentClass()
getTargetWComponentClass in class ByWComponentCopyright © 2016. All rights reserved.