Actions: make `pause` more strongly typed
Strong typing #ftw
@@ -509,8 +509,6 @@ public Actions dragAndDropBy(WebElement source, int xOffset, int yOffset) {
*
* @param pause pause duration, in milliseconds.
* @return A self reference.
- *
- * @deprecated 'Pause' is considered to be a bad design practice.
*/
@Deprecated
public Actions pause(long pause) {
@@ -521,6 +519,15 @@ public Actions pause(long pause) {
return tick(new Pause(defaultMouse, Duration.ofMillis(pause)));
}
+ public Actions pause(Duration duration) {
+ Preconditions.checkNotNull(duration, "Duration of pause not set");
+ if (isBuildingActions()) {
+ action.addAction(new PauseAction(duration.toMillis()));
+ }
+
+ return tick(new Pause(defaultMouse, duration));
+ }
+
public Actions tick(Interaction... actions) {
// All actions must be for a unique source.
Set<InputSource> seenSources = new HashSet<>();
