Package com.github.loyada.jdollarx
Class Operations
- java.lang.Object
-
- com.github.loyada.jdollarx.Operations
-
public class Operations extends Object
Internal implementation of various browser operations
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Operations.DragAndDrop
internal implementation not be instantiated directly - Action of drag-and-dropstatic class
Operations.KeysDown
internal implementation not be instantiated directly - Action of key-downstatic class
Operations.KeysSender
internal implementation not be instantiated directly - Action of sending keys to browserstatic class
Operations.OperationFailedException
static class
Operations.ReleaseKey
internal implementation not be instantiated directly - Action of releasing a key (key up)static class
Operations.Scroll
internal implementation not be instantiated directly - Action of scrollstatic class
Operations.ScrollElement
internal implementation not be instantiated directly - Action of scroll within an element
-
Constructor Summary
Constructors Constructor Description Operations()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
doWithRetries(Runnable action, int numberOfRetries, int sleepInMillisec)
Retry an action/assertion up to a number of times, with delay after each time.static <T> T
doWithRetries(Callable<T> action, int numberOfRetries, int sleepInMillisec)
Retry an action up to a number of times, with delay after each time.static <T,V extends Exception>
TdoWithRetriesForException(Callable<T> action, Class<V> exceptionClass, int numberOfRetries, int sleepInMillisec)
-
-
-
Method Detail
-
doWithRetries
public static void doWithRetries(Runnable action, int numberOfRetries, int sleepInMillisec)
Retry an action/assertion up to a number of times, with delay after each time. For example:doWithRetries(() -> assertThat(div.withClass("foo"), isDisplayedIn(browser)), 5, 10);
- Parameters:
action
- the action to try. It's a runnable - no input parapeters and does not return anything.numberOfRetries
- - maximum number of retriessleepInMillisec
- - delay between consecutive retries
-
doWithRetries
public static <T> T doWithRetries(Callable<T> action, int numberOfRetries, int sleepInMillisec) throws Exception
Retry an action up to a number of times, with delay after each time. For example:WebElement el = doWithRetries(() -> browser.find(div.withClass("foo"), 5, 10);
- Type Parameters:
T
- any type that the function returns- Parameters:
action
- the action to try. It has no input parameters, but returns a valuenumberOfRetries
- - maximum number of retriessleepInMillisec
- - delay between consecutive retries- Returns:
- returns the result of the callable
- Throws:
Exception
- the exception thrown by the last try in case it exceeded the number of retries.
-
-