public class ComponentLocator extends Object
The main use for this class is locating components for automated testing purposes.
com.vaadin.client.ComponentLocator| Constructor and Description |
|---|
ComponentLocator(ApplicationConnection client)
Construct a ComponentLocator for the given ApplicationConnection.
|
| Modifier and Type | Method and Description |
|---|---|
ApplicationConnection |
getClient()
Returns the
ApplicationConnection used by this locator. |
com.google.gwt.user.client.Element |
getElementByPath(String path)
Locates an element using a String locator (path) which identifies a DOM
element.
|
com.google.gwt.user.client.Element |
getElementByPathStartingAt(String path,
com.google.gwt.dom.client.Element root)
Locates an element using a String locator (path) which identifies a DOM
element.
|
com.google.gwt.core.client.JsArray<com.google.gwt.dom.client.Element> |
getElementsByPath(String path)
Locates elements using a String locator (path) which identifies DOM
elements.
|
com.google.gwt.core.client.JsArray<com.google.gwt.dom.client.Element> |
getElementsByPathStartingAt(String path,
com.google.gwt.dom.client.Element root)
Locates elements using a String locator (path) which identifies DOM
elements.
|
String |
getPathForElement(com.google.gwt.user.client.Element targetElement)
Deprecated.
As of 7.2, call and override
getPathForElement(Element) instead |
String |
getPathForElement(com.google.gwt.dom.client.Element targetElement)
Generates a String locator which uniquely identifies the target element.
|
boolean |
isValidForLegacyLocator(String path)
Check if a given selector is valid for LegacyLocatorStrategy.
|
public ComponentLocator(ApplicationConnection client)
client - ApplicationConnection instance for the application.@Deprecated public String getPathForElement(com.google.gwt.user.client.Element targetElement)
getPathForElement(Element) insteadgetElementByPath(String) method can be used for the inverse
operation, i.e. locating an element based on the return value from this
method.
Note that getElementByPath(getPathForElement(element)) == element is not always true as #getPathForElement(Element) can return a path to another element if the widget determines an action on the other element will give the same result as the action on the target element.
targetElement - The element to generate a path for.public String getPathForElement(com.google.gwt.dom.client.Element targetElement)
getElementByPath(String) method can be used for the inverse
operation, i.e. locating an element based on the return value from this
method.
Note that getElementByPath(getPathForElement(element)) == element is not always true as #getPathForElement(Element) can return a path to another element if the widget determines an action on the other element will give the same result as the action on the target element.
targetElement - The element to generate a path for.public com.google.gwt.user.client.Element getElementByPath(String path)
getPathForElement(Element) method can be used for
the inverse operation, i.e. generating a string expression for a DOM
element.path - The String locator which identifies the target element.path or null if the element
could not be located.public com.google.gwt.core.client.JsArray<com.google.gwt.dom.client.Element> getElementsByPath(String path)
path - The String locator which identifies target elements.path or
empty array if elements could not be located.public com.google.gwt.core.client.JsArray<com.google.gwt.dom.client.Element> getElementsByPathStartingAt(String path, com.google.gwt.dom.client.Element root)
path - The path of elements to be foundroot - The root element where the path is anchoredpath or
empty array if elements could not be located.getElementByPath(String)public com.google.gwt.user.client.Element getElementByPathStartingAt(String path, com.google.gwt.dom.client.Element root)
path - The path of the element to be foundroot - The root element where the path is anchoredpath or null if the element
could not be located.getElementByPath(String)public ApplicationConnection getClient()
ApplicationConnection used by this locator.
This method is primarily for internal use by the framework.
public boolean isValidForLegacyLocator(String path)
path - Vaadin selector pathCopyright © 2016 Vaadin Ltd. All rights reserved.