Modifier and Type | Field and Description |
---|---|
static int |
URLCHANGE_MAX_WAIT |
Constructor and Description |
---|
Locator() |
Modifier and Type | Method and Description |
---|---|
static org.openqa.selenium.WebElement |
findElement(org.openqa.selenium.By by) |
static org.openqa.selenium.WebElement |
findElementAndWaitUntilEnabled(org.openqa.selenium.By by)
Finds the first
WebElement using the given method, with the default timeout. |
static org.openqa.selenium.WebElement |
findElementAndWaitUntilEnabled(org.openqa.selenium.By by,
int findElementTimeout,
int waitUntilEnabledTimeout)
Finds the first
WebElement using the given method, with a findElementTimeout . |
static org.openqa.selenium.WebElement |
findElementAndWaitUntilEnabled(org.openqa.selenium.WebElement parentElement,
org.openqa.selenium.By by,
int findElementTimeout,
int waitUntilEnabledTimeout)
Finds the first
WebElement using the given method, with a findElementTimeout , inside an optional
parentElement . |
static List<org.openqa.selenium.WebElement> |
findElementsWithTimeout(org.openqa.selenium.By by) |
static void |
findElementWaitUntilEnabledAndClick(org.openqa.selenium.By by)
Finds the first
WebElement using the given method, with the default timeout. |
static void |
findElementWaitUntilEnabledAndClick(org.openqa.selenium.By by,
int findElementTimeout,
int waitUntilEnabledTimeout)
Deprecated.
since 8.3, use
findElementWaitUntilEnabledAndClick(WebElement, By) |
static void |
findElementWaitUntilEnabledAndClick(org.openqa.selenium.WebElement parentElement,
org.openqa.selenium.By by)
Finds the first
WebElement using the given method, with the default timeout, inside an optional
parentElement . |
static void |
findElementWaitUntilEnabledAndClick(org.openqa.selenium.WebElement parentElement,
org.openqa.selenium.By by,
int findElementTimeout,
int waitUntilEnabledTimeout)
Finds the first
WebElement using the given method, with a findElementTimeout , inside an optional
parentElement . |
static org.openqa.selenium.WebElement |
findElementWithTimeout(org.openqa.selenium.By by)
Finds the first
WebElement using the given method, with a timeout. |
static org.openqa.selenium.WebElement |
findElementWithTimeout(org.openqa.selenium.By by,
int timeout)
Finds the first
WebElement using the given method, with a timeout. |
static org.openqa.selenium.WebElement |
findElementWithTimeout(org.openqa.selenium.By by,
int timeout,
org.openqa.selenium.WebElement parentElement)
Finds the first
WebElement using the given method, with a timeout. |
static org.openqa.selenium.WebElement |
findElementWithTimeout(org.openqa.selenium.By by,
org.openqa.selenium.WebElement parentElement)
Finds the first
WebElement using the given method, with a timeout. |
static void |
findElementWithTimeoutAndClick(org.openqa.selenium.By by)
Finds the first
WebElement using the given method, with a findElementTimeout . |
static org.openqa.selenium.WebElement |
findParentTag(org.openqa.selenium.WebElement elt,
String tagName)
Return parent element with given tag name.
|
static org.openqa.selenium.support.ui.FluentWait<org.openqa.selenium.WebDriver> |
getFluentWait() |
static boolean |
hasElementWithTimeout(org.openqa.selenium.By by)
Checks if a corresponding elements is present, with a timeout.
|
static boolean |
hasElementWithTimeout(org.openqa.selenium.By by,
int timeout)
Checks if a corresponding elements is present, with a timeout.
|
static boolean |
scrollAndForceClick(org.openqa.selenium.WebElement element)
Forces a click on an element, to workaround non-effective clicks in miscellaneous situations, after having
scrolled to it.
|
static void |
scrollToElement(org.openqa.selenium.WebElement element)
Scrolls to the element in the view: allows to safely click on it afterwards.
|
static void |
waitForTextNotPresent(org.openqa.selenium.WebElement element,
String text)
Fluent wait for text to be not present in the given element.
|
static void |
waitForTextPresent(org.openqa.selenium.By locator,
String text)
Fluent wait for text to be present in the element retrieved with the given method.
|
static void |
waitForTextPresent(org.openqa.selenium.WebElement element,
String text)
Fluent wait for text to be present in the given element.
|
static void |
waitUntilElementNotPresent(org.openqa.selenium.By locator)
Fluent wait for an element not to be present, checking every 100 ms.
|
static void |
waitUntilElementPresent(org.openqa.selenium.By locator)
Fluent wait for an element to be present, checking every 100 ms.
|
static void |
waitUntilEnabled(org.openqa.selenium.WebElement element)
Waits until an element is enabled, with a timeout.
|
static void |
waitUntilEnabled(org.openqa.selenium.WebElement element,
int timeout)
Waits until an element is enabled, with a timeout.
|
static void |
waitUntilEnabledAndClick(org.openqa.selenium.WebElement element)
Waits until the element is enabled, with a default timeout.
|
static void |
waitUntilEnabledAndClick(org.openqa.selenium.WebElement element,
int waitUntilEnabledTimeout)
Waits until the element is enabled, with a
waitUntilEnabledTimeout . |
static void |
waitUntilGivenFunction(com.google.common.base.Function<org.openqa.selenium.WebDriver,Boolean> function)
Fluent wait on a the given function, checking every 100 ms.
|
static <K extends Throwable> |
waitUntilGivenFunctionIgnoreAll(com.google.common.base.Function<org.openqa.selenium.WebDriver,Boolean> function,
Class<? extends K>... ignoredExceptions)
Fluent wait on a the given function, checking every 100 ms.
|
static <K extends Throwable> |
waitUntilGivenFunctionIgnoring(com.google.common.base.Function<org.openqa.selenium.WebDriver,Boolean> function,
Class<? extends K> ignoredException)
Fluent wait on a the given function, checking every 100 ms.
|
static void |
waitUntilURLContains(String string)
Waits until the URL contains the string given in parameter, with a timeout.
|
static void |
waitUntilURLDifferentFrom(String url)
Waits until the URL is different from the one given in parameter, with a timeout.
|
static void |
waitUntilURLNotContain(String string)
Waits until the URL does not contain the string given in parameter, with a timeout.
|
static void |
waitUntilWindowClosed(String windowHandle) |
public static final int URLCHANGE_MAX_WAIT
public Locator()
public static org.openqa.selenium.WebElement findElement(org.openqa.selenium.By by)
public static org.openqa.selenium.WebElement findElementAndWaitUntilEnabled(org.openqa.selenium.By by) throws org.openqa.selenium.NotFoundException
WebElement
using the given method, with the default timeout. Then waits until the element
is enabled, with the default timeout.by
- the locating mechanismorg.openqa.selenium.NotFoundException
- if the element is not found or not enabledpublic static org.openqa.selenium.WebElement findElementAndWaitUntilEnabled(org.openqa.selenium.By by, int findElementTimeout, int waitUntilEnabledTimeout) throws org.openqa.selenium.NotFoundException
WebElement
using the given method, with a findElementTimeout
. Then waits until
the element is enabled, with a waitUntilEnabledTimeout
.by
- the locating mechanismfindElementTimeout
- the find element timeout in millisecondswaitUntilEnabledTimeout
- the wait until enabled timeout in millisecondsorg.openqa.selenium.NotFoundException
- if the element is not found or not enabledpublic static org.openqa.selenium.WebElement findElementAndWaitUntilEnabled(org.openqa.selenium.WebElement parentElement, org.openqa.selenium.By by, int findElementTimeout, int waitUntilEnabledTimeout) throws org.openqa.selenium.NotFoundException
WebElement
using the given method, with a findElementTimeout
, inside an optional
parentElement
. Then waits until the element is enabled, with a waitUntilEnabledTimeout
.parentElement
- the parent element (can be null)by
- the locating mechanismfindElementTimeout
- the find element timeout in millisecondswaitUntilEnabledTimeout
- the wait until enabled timeout in millisecondsorg.openqa.selenium.NotFoundException
- if the element is not found or not enabledpublic static List<org.openqa.selenium.WebElement> findElementsWithTimeout(org.openqa.selenium.By by) throws org.openqa.selenium.NoSuchElementException
org.openqa.selenium.NoSuchElementException
public static void findElementWaitUntilEnabledAndClick(org.openqa.selenium.By by) throws org.openqa.selenium.NotFoundException
WebElement
using the given method, with the default timeout. Then waits until the element
is enabled, with the default timeout. Then clicks on the element.by
- the locating mechanismorg.openqa.selenium.NotFoundException
- if the element is not found or not enabledpublic static void findElementWaitUntilEnabledAndClick(org.openqa.selenium.WebElement parentElement, org.openqa.selenium.By by) throws org.openqa.selenium.NotFoundException
WebElement
using the given method, with the default timeout, inside an optional
parentElement
. Then waits until the element is enabled, with the default timeout. Then clicks on the
element.parentElement
- the parent element (can be null)by
- the locating mechanismorg.openqa.selenium.NotFoundException
- if the element is not found or not enabledpublic static org.openqa.selenium.WebElement findElementWithTimeout(org.openqa.selenium.By by) throws org.openqa.selenium.NoSuchElementException
WebElement
using the given method, with a timeout.by
- the locating mechanismorg.openqa.selenium.NoSuchElementException
- when not foundpublic static boolean hasElementWithTimeout(org.openqa.selenium.By by)
by
- the locating mechanismpublic static org.openqa.selenium.WebElement findElementWithTimeout(org.openqa.selenium.By by, int timeout) throws org.openqa.selenium.NoSuchElementException
WebElement
using the given method, with a timeout.by
- the locating mechanismtimeout
- the timeout in millisecondsorg.openqa.selenium.NoSuchElementException
- when not foundpublic static boolean hasElementWithTimeout(org.openqa.selenium.By by, int timeout)
by
- the locating mechanismtimeout
- the timeout in millisecondspublic static org.openqa.selenium.WebElement findElementWithTimeout(org.openqa.selenium.By by, int timeout, org.openqa.selenium.WebElement parentElement) throws org.openqa.selenium.NoSuchElementException
WebElement
using the given method, with a timeout.by
- the locating mechanismtimeout
- the timeout in millisecondsparentElement
- find from the elementorg.openqa.selenium.NoSuchElementException
- when not foundpublic static org.openqa.selenium.WebElement findElementWithTimeout(org.openqa.selenium.By by, org.openqa.selenium.WebElement parentElement) throws org.openqa.selenium.NoSuchElementException
WebElement
using the given method, with a timeout.by
- the locating mechanismtimeout
- the timeout in millisecondsparentElement
- find from the elementorg.openqa.selenium.NoSuchElementException
- when not foundpublic static org.openqa.selenium.support.ui.FluentWait<org.openqa.selenium.WebDriver> getFluentWait()
public static void waitForTextNotPresent(org.openqa.selenium.WebElement element, String text)
public static void waitForTextPresent(org.openqa.selenium.By locator, String text)
public static void waitForTextPresent(org.openqa.selenium.WebElement element, String text)
@Deprecated public static void findElementWaitUntilEnabledAndClick(org.openqa.selenium.By by, int findElementTimeout, int waitUntilEnabledTimeout) throws org.openqa.selenium.NotFoundException
findElementWaitUntilEnabledAndClick(WebElement, By)
WebElement
using the given method, with a findElementTimeout
. Then waits until
the element is enabled, with a waitUntilEnabledTimeout
. Scroll to it, then clicks on the element.by
- the locating mechanismfindElementTimeout
- the find element timeout in millisecondswaitUntilEnabledTimeout
- the wait until enabled timeout in millisecondsorg.openqa.selenium.NotFoundException
- if the element is not found or not enabledpublic static void findElementWaitUntilEnabledAndClick(org.openqa.selenium.WebElement parentElement, org.openqa.selenium.By by, int findElementTimeout, int waitUntilEnabledTimeout) throws org.openqa.selenium.NotFoundException
WebElement
using the given method, with a findElementTimeout
, inside an optional
parentElement
. Then waits until the element is enabled, with a waitUntilEnabledTimeout
. Scroll to
it, then clicks on the element.parentElement
- the parent element (can be null)by
- the locating mechanismfindElementTimeout
- the find element timeout in millisecondswaitUntilEnabledTimeout
- the wait until enabled timeout in millisecondsorg.openqa.selenium.NotFoundException
- if the element is not found or not enabledpublic static void waitUntilEnabledAndClick(org.openqa.selenium.WebElement element) throws org.openqa.selenium.NotFoundException
element
- the elementorg.openqa.selenium.NotFoundException
- if the element is not found or not enabledpublic static void waitUntilEnabledAndClick(org.openqa.selenium.WebElement element, int waitUntilEnabledTimeout) throws org.openqa.selenium.NotFoundException
waitUntilEnabledTimeout
. Scroll to it, then clicks on the
element.element
- the elementwaitUntilEnabledTimeout
- the wait until enabled timeout in millisecondsorg.openqa.selenium.NotFoundException
- if the element is not found or not enabledpublic static void findElementWithTimeoutAndClick(org.openqa.selenium.By by) throws org.openqa.selenium.NotFoundException
WebElement
using the given method, with a findElementTimeout
. Then clicks on the
element.by
- the locating mechanismorg.openqa.selenium.NotFoundException
- if the element is not found or not enabledpublic static void waitUntilElementNotPresent(org.openqa.selenium.By locator)
public static void waitUntilWindowClosed(String windowHandle)
public static void waitUntilElementPresent(org.openqa.selenium.By locator)
public static void waitUntilEnabled(org.openqa.selenium.WebElement element) throws org.openqa.selenium.NotFoundException
element
- the elementorg.openqa.selenium.NotFoundException
public static void waitUntilEnabled(org.openqa.selenium.WebElement element, int timeout) throws org.openqa.selenium.NotFoundException
element
- the elementtimeout
- the timeout in millisecondsorg.openqa.selenium.NotFoundException
public static void waitUntilGivenFunction(com.google.common.base.Function<org.openqa.selenium.WebDriver,Boolean> function)
function
- @SafeVarargs public static <K extends Throwable> void waitUntilGivenFunctionIgnoreAll(com.google.common.base.Function<org.openqa.selenium.WebDriver,Boolean> function, Class<? extends K>... ignoredExceptions)
function
- ignoredExceptions
- the types of exceptions to ignore.public static <K extends Throwable> void waitUntilGivenFunctionIgnoring(com.google.common.base.Function<org.openqa.selenium.WebDriver,Boolean> function, Class<? extends K> ignoredException)
function
- ignoredException
- the type of exception to ignore.public static void waitUntilURLContains(String string)
string
- the string that is to be containedpublic static void waitUntilURLDifferentFrom(String url)
url
- the URL to compare topublic static void waitUntilURLNotContain(String string)
string
- the string that is not to be containedpublic static org.openqa.selenium.WebElement findParentTag(org.openqa.selenium.WebElement elt, String tagName)
Throws a NoSuchElementException
error if no element found.
public static final void scrollToElement(org.openqa.selenium.WebElement element)
executor
- the javascript executor, usually WebDriver
element
- the element to scroll topublic static final boolean scrollAndForceClick(org.openqa.selenium.WebElement element)
executor
- the javascript executor, usually WebDriver
element
- the element to scroll toCopyright © 2019 Nuxeo. All rights reserved.