Skip to content

Commit 95b4df9

Browse files
committed
Actions: make pause more strongly typed
Strong typing #ftw
1 parent db435db commit 95b4df9

File tree

1 file changed

+9
-2
lines changed
  • java/client/src/org/openqa/selenium/interactions

1 file changed

+9
-2
lines changed

java/client/src/org/openqa/selenium/interactions/Actions.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,8 +509,6 @@ public Actions dragAndDropBy(WebElement source, int xOffset, int yOffset) {
509509
*
510510
* @param pause pause duration, in milliseconds.
511511
* @return A self reference.
512-
*
513-
* @deprecated 'Pause' is considered to be a bad design practice.
514512
*/
515513
@Deprecated
516514
public Actions pause(long pause) {
@@ -521,6 +519,15 @@ public Actions pause(long pause) {
521519
return tick(new Pause(defaultMouse, Duration.ofMillis(pause)));
522520
}
523521

522+
public Actions pause(Duration duration) {
523+
Preconditions.checkNotNull(duration, "Duration of pause not set");
524+
if (isBuildingActions()) {
525+
action.addAction(new PauseAction(duration.toMillis()));
526+
}
527+
528+
return tick(new Pause(defaultMouse, duration));
529+
}
530+
524531
public Actions tick(Interaction... actions) {
525532
// All actions must be for a unique source.
526533
Set<InputSource> seenSources = new HashSet<>();

0 commit comments

Comments
 (0)