public final class Utils extends Object
Modifier and Type | Field and Description |
---|---|
static org.openqa.selenium.By |
BY_BODY |
static org.openqa.selenium.By |
BY_HTML |
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static org.openqa.selenium.WebElement |
getAncestorOfElement(org.openqa.selenium.WebElement element)
Returns the closest ancestor from the element.
|
static org.openqa.selenium.WebElement |
getAncestorOfElement(org.openqa.selenium.WebElement element,
String tagNameOfAncestorElement)
Returns the closest ancestor with tagName from the element.
|
static <T> com.google.common.base.Optional<T> |
getComponentOption(org.openqa.selenium.WebElement rootOfComponent,
String option)
Returns the given option of the component determined by its root element.
|
static <T> com.google.common.base.Optional<T> |
getComponentOptionDocumentObjectSafe(org.openqa.selenium.WebElement rootOfComponent,
String option)
Returns the given option of the component determined by its root element in a document object safe way.
|
static org.openqa.selenium.JavascriptExecutor |
getExecutorFromElement(org.openqa.selenium.WebElement element) |
static int |
getIndexOfElement(org.openqa.selenium.WebElement element)
Returns the result of invocation of jQuery function
index() on given element. |
static Locations |
getLocations(org.openqa.selenium.WebElement root)
Returns Locations of input element.
|
static org.openqa.selenium.WebElement |
getNextSiblingOfElement(org.openqa.selenium.WebElement element)
Returns the closest following sibling from the element.
|
static org.openqa.selenium.WebElement |
getNextSiblingOfElement(org.openqa.selenium.WebElement element,
String tagNameofSibling)
Returns the closest following sibling with tagName from the element.
|
static org.openqa.selenium.WebElement |
getPreviousSiblingOfElement(org.openqa.selenium.WebElement element)
Returns the closest preceding sibling from the element.
|
static org.openqa.selenium.WebElement |
getPreviousSiblingOfElement(org.openqa.selenium.WebElement element,
String tagNameofSibling)
Returns the closest preceding sibling with tagName from the element.
|
static String |
getTextFromHiddenElement(org.openqa.selenium.JavascriptExecutor executor,
org.openqa.selenium.WebElement element)
Returns text from given hidden element.
|
static String |
getTextFromHiddenElement(org.openqa.selenium.WebElement element)
Returns text from given hidden element.
|
static long |
getWaitAjaxDefaultTimeout(org.openqa.selenium.WebDriver browser)
Returns the default timeout for Ajax waiting in milliseconds.
|
static long |
getWaitGUIDefaultTimeout(org.openqa.selenium.WebDriver browser)
Returns the default timeout for GUI waiting in milliseconds.
|
static <T> T |
invokeRichFacesJSAPIFunction(org.openqa.selenium.WebElement componentRoot,
String functionWithParams)
Invokes RF JS API function on given root of RF component.
|
static boolean |
isVisible(org.openqa.selenium.SearchContext searchContext,
org.openqa.selenium.By by) |
static boolean |
isVisible(org.openqa.selenium.WebElement e) |
static void |
jQ(org.openqa.selenium.JavascriptExecutor executor,
String cmd,
org.openqa.selenium.WebElement element)
Executes jQuery command on input element.
|
static void |
jQ(String cmd,
org.openqa.selenium.WebElement element)
Executes jQuery command on input element.
|
static String |
returningJQ(org.openqa.selenium.JavascriptExecutor executor,
String cmd,
org.openqa.selenium.WebElement element)
Executes returning jQuery command on input element.
|
static String |
returningJQ(String cmd,
org.openqa.selenium.WebElement element)
Executes returning jQuery command on input element.
|
static void |
tolerantAssertLocationsEquals(Locations l1,
Locations l2,
int xTolerance,
int yTolerance,
String message)
Asserts that two locations are equal with some allowed tolerance.
|
static void |
tolerantAssertLocationsEquals(org.openqa.selenium.WebElement element,
Locations l2,
int xTolerance,
int yTolerance,
String message)
Asserts that elements locations and some other locations are equal with some allowed tolerance.
|
static void |
tolerantAssertPointEquals(org.openqa.selenium.Point p1,
org.openqa.selenium.Point p2,
int xTolerance,
int yTolerance,
String message)
Asserts that two points are equal with some allowed tolerance.
|
static void |
triggerJQ(org.openqa.selenium.JavascriptExecutor executor,
String event,
org.openqa.selenium.WebElement element)
Executes jQuery trigger command on input element.
|
static void |
triggerJQ(String event,
org.openqa.selenium.WebElement element)
Executes jQuery trigger command on input element.
|
static org.openqa.selenium.WebElement |
unwrap(org.openqa.selenium.WebElement element) |
public static final org.openqa.selenium.By BY_BODY
public static final org.openqa.selenium.By BY_HTML
public static org.openqa.selenium.JavascriptExecutor getExecutorFromElement(org.openqa.selenium.WebElement element)
public static int getIndexOfElement(org.openqa.selenium.WebElement element)
index()
on given element.element
- element on which the command will be executed, has to be instance of
org.jboss.arquillian.graphene.proxy.GrapheneProxyInstancepublic static org.openqa.selenium.WebElement getAncestorOfElement(org.openqa.selenium.WebElement element)
element
- element from which will be the ancestor foundpublic static org.openqa.selenium.WebElement getAncestorOfElement(org.openqa.selenium.WebElement element, String tagNameOfAncestorElement)
element
- element from which will be the ancestor foundtagNameOfAncestorElement
- tagName of the ancestor to be foundpublic static org.openqa.selenium.WebElement getNextSiblingOfElement(org.openqa.selenium.WebElement element)
element
- element from which will be the sibling foundpublic static org.openqa.selenium.WebElement getNextSiblingOfElement(org.openqa.selenium.WebElement element, String tagNameofSibling)
element
- element from which will be the sibling foundtagNameofSibling
- tagName of the sibling to be foundpublic static org.openqa.selenium.WebElement getPreviousSiblingOfElement(org.openqa.selenium.WebElement element)
element
- element from which will be the sibling foundpublic static org.openqa.selenium.WebElement getPreviousSiblingOfElement(org.openqa.selenium.WebElement element, String tagNameofSibling)
element
- element from which will be the sibling foundtagNameofSibling
- tagName of the sibling to be foundpublic static <T> com.google.common.base.Optional<T> getComponentOption(org.openqa.selenium.WebElement rootOfComponent, String option)
rootOfComponent
- option
- public static <T> com.google.common.base.Optional<T> getComponentOptionDocumentObjectSafe(org.openqa.selenium.WebElement rootOfComponent, String option)
rootOfComponent
- option
- public static Locations getLocations(org.openqa.selenium.WebElement root)
Locations
public static String getTextFromHiddenElement(org.openqa.selenium.JavascriptExecutor executor, org.openqa.selenium.WebElement element)
element
- not visible elementpublic static String getTextFromHiddenElement(org.openqa.selenium.WebElement element)
element
- not visible elementpublic static <T> T invokeRichFacesJSAPIFunction(org.openqa.selenium.WebElement componentRoot, String functionWithParams)
componentRoot
- root of the RF componentfunctionWithParams
- JS API function with params (e.g. setValue(new Date('October 10, 2012 12:00:00'))
)public static boolean isVisible(org.openqa.selenium.WebElement e)
public static boolean isVisible(org.openqa.selenium.SearchContext searchContext, org.openqa.selenium.By by)
public static void jQ(org.openqa.selenium.JavascriptExecutor executor, String cmd, org.openqa.selenium.WebElement element)
cmd
- command to be executedelement
- element on which the command will be executedpublic static void jQ(String cmd, org.openqa.selenium.WebElement element)
cmd
- command to be executedelement
- element on which the command will be executedpublic static String returningJQ(org.openqa.selenium.JavascriptExecutor executor, String cmd, org.openqa.selenium.WebElement element)
cmd
- command to be executedelement
- element on which the command will be executedpublic static String returningJQ(String cmd, org.openqa.selenium.WebElement element)
cmd
- command to be executedelement
- element on which the command will be executedpublic static void tolerantAssertPointEquals(org.openqa.selenium.Point p1, org.openqa.selenium.Point p2, int xTolerance, int yTolerance, String message)
public static void tolerantAssertLocationsEquals(Locations l1, Locations l2, int xTolerance, int yTolerance, String message)
public static void tolerantAssertLocationsEquals(org.openqa.selenium.WebElement element, Locations l2, int xTolerance, int yTolerance, String message)
public static void triggerJQ(org.openqa.selenium.JavascriptExecutor executor, String event, org.openqa.selenium.WebElement element)
executor
- JavascriptExecutorevent
- event to be triggeredelement
- element on which the command will be executedpublic static void triggerJQ(String event, org.openqa.selenium.WebElement element)
event
- event to be triggeredelement
- element on which the command will be executed, has to be instance of
org.jboss.arquillian.graphene.proxy.GrapheneProxyInstancepublic static org.openqa.selenium.WebElement unwrap(org.openqa.selenium.WebElement element)
public static long getWaitGUIDefaultTimeout(org.openqa.selenium.WebDriver browser)
browser
- public static long getWaitAjaxDefaultTimeout(org.openqa.selenium.WebDriver browser)
browser
- Copyright © 2015 JBoss by Red Hat. All Rights Reserved.