|
32 | 32 | import org.openqa.selenium.WebElement;
|
33 | 33 | import org.openqa.selenium.interactions.HasInputDevices;
|
34 | 34 | import org.openqa.selenium.interactions.HasTouchScreen;
|
| 35 | +import org.openqa.selenium.interactions.Interactive; |
35 | 36 | import org.openqa.selenium.interactions.Keyboard;
|
36 | 37 | import org.openqa.selenium.interactions.Mouse;
|
| 38 | +import org.openqa.selenium.interactions.Sequence; |
37 | 39 | import org.openqa.selenium.interactions.TouchScreen;
|
38 | 40 | import org.openqa.selenium.interactions.internal.Coordinates;
|
39 | 41 | import org.openqa.selenium.interactions.internal.Locatable;
|
|
52 | 54 | import java.net.URL;
|
53 | 55 | import java.util.ArrayList;
|
54 | 56 | import java.util.Arrays;
|
| 57 | +import java.util.Collection; |
55 | 58 | import java.util.HashMap;
|
56 | 59 | import java.util.HashSet;
|
57 | 60 | import java.util.List;
|
|
65 | 68 | * {@link WebDriverEventListener}, e.g. for logging purposes.
|
66 | 69 | */
|
67 | 70 | public class EventFiringWebDriver implements WebDriver, JavascriptExecutor, TakesScreenshot,
|
68 |
| - WrapsDriver, HasInputDevices, HasTouchScreen { |
| 71 | + WrapsDriver, HasInputDevices, HasTouchScreen, |
| 72 | + Interactive { |
69 | 73 |
|
70 | 74 | private final WebDriver driver;
|
71 | 75 |
|
@@ -332,6 +336,28 @@ public TouchScreen getTouch() {
|
332 | 336 | + " user interactions yet.");
|
333 | 337 | }
|
334 | 338 |
|
| 339 | + @Override |
| 340 | + public void perform(Collection<Sequence> actions) { |
| 341 | + if (driver instanceof Interactive) { |
| 342 | + ((Interactive) driver).perform(actions); |
| 343 | + return; |
| 344 | + } |
| 345 | + throw new UnsupportedOperationException("Underlying driver does not implement advanced" |
| 346 | + + " user interactions yet."); |
| 347 | + |
| 348 | + } |
| 349 | + |
| 350 | + @Override |
| 351 | + public void resetInputState() { |
| 352 | + if (driver instanceof Interactive) { |
| 353 | + ((Interactive) driver).resetInputState(); |
| 354 | + return; |
| 355 | + } |
| 356 | + throw new UnsupportedOperationException("Underlying driver does not implement advanced" |
| 357 | + + " user interactions yet."); |
| 358 | + |
| 359 | + } |
| 360 | + |
335 | 361 | private class EventFiringWebElement implements WebElement, WrapsElement, WrapsDriver, Locatable {
|
336 | 362 |
|
337 | 363 | private final WebElement element;
|
|
0 commit comments