Skip to content

Commit

Permalink
Actions: make pause more strongly typed
Browse files Browse the repository at this point in the history
Strong typing #ftw
  • Loading branch information
shs96c committed Feb 28, 2017
1 parent db435db commit 95b4df9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions java/client/src/org/openqa/selenium/interactions/Actions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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<>();
Expand Down

0 comments on commit 95b4df9

Please sign in to comment.