public class ByWComponent
extends org.openqa.selenium.By
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 searched for.
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 |
|---|
ByWComponent(ComponentWithContext componentWithContext)
Creates a ByWComponent which searches for a component instance in the given context.
|
ByWComponent(WComponent component)
Creates a ByWComponent which searches for a component instance.
|
ByWComponent(WComponent component,
UIContext context)
Creates a ByWComponent which searches for a component instance in the given context.
|
ByWComponent(WComponent component,
UIContext context,
Object value)
Creates a ByWComponent which searches for a component instance in the given context.
|
| Modifier and Type | Method and Description |
|---|---|
protected List<org.openqa.selenium.WebElement> |
findElement(org.openqa.selenium.SearchContext searchContext,
UIContext uiContext,
WComponent component,
Object compValue)
Perform the driver search for the given component.
|
List<org.openqa.selenium.WebElement> |
findElements(org.openqa.selenium.SearchContext searchContext) |
static org.openqa.selenium.WebElement |
findValue(org.openqa.selenium.WebElement current,
WComponent component,
UIContext context,
Object value)
Narrows down the search for a WebElement to find the appropriate value.
|
protected WComponent |
getComponent() |
protected UIContext |
getContext() |
Class<? extends WComponent> |
getTargetWComponentClass() |
protected Object |
getValue() |
static void |
narrowResults(List<org.openqa.selenium.WebElement> results,
WComponent component,
UIContext context,
Object value)
Narrows the results of a search using the given value.
|
void |
setContext(UIContext context)
Set the context.
|
String |
toString() |
public ByWComponent(ComponentWithContext componentWithContext)
context should be the row context for the row you want to return.componentWithContext - the component to search for.public ByWComponent(WComponent component)
component - the component instance to search for.public ByWComponent(WComponent component, UIContext context)
context should be the row context for the row you want to return.component - the component instance to search for.context - the context to search in, use null for the default context.public ByWComponent(WComponent component, UIContext context, Object value)
context should be the row context for the row you want to return.component - the component instance to search for.context - the context to search in, use null for the default context.value - If not null, narrow the search by value for e.g. list or drop-down entries.public void setContext(UIContext context)
context - the context to set.protected UIContext getContext()
protected WComponent getComponent()
protected Object getValue()
protected List<org.openqa.selenium.WebElement> findElement(org.openqa.selenium.SearchContext searchContext, UIContext uiContext, WComponent component, Object compValue)
searchContext - the SearchContext to search within.uiContext - the UIContext to retrieve the id/name from.component - the component to find.compValue - the component value to match.public List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.SearchContext searchContext)
findElements in class org.openqa.selenium.Bypublic String toString()
toString in class org.openqa.selenium.Bypublic Class<? extends WComponent> getTargetWComponentClass()
public static org.openqa.selenium.WebElement findValue(org.openqa.selenium.WebElement current,
WComponent component,
UIContext context,
Object value)
current - the current WebElement which was reached during a search.component - the component corresponding to the given WebElement.context - the context for the component.value - the value to search for.public static void narrowResults(List<org.openqa.selenium.WebElement> results, WComponent component, UIContext context, Object value)
results - the search results to modify.component - the component.context - the context for the component.value - the value to search for.Copyright © 2018. All rights reserved.