* User facing API for generating complex user gestures. This class should not * be instantiated directly. Instead, users should create new instances by * calling ./webdriver.WebDriver#actions WebDriver.actions(). * * ### Action Ticks * * Action sequences are divided into a series of "t
| 581 | * @see <https://www.w3.org/TR/webdriver/#actions> |
| 582 | */ |
| 583 | class Actions { |
| 584 | /** |
| 585 | * @param {!Executor} executor The object to execute the configured |
| 586 | * actions with. |
| 587 | * @param {{async: (boolean|undefined)}} options Options for this action |
| 588 | * sequence (see class description for details). |
| 589 | */ |
| 590 | constructor(executor, { async = false } = {}) { |
| 591 | /** @private @const */ |
| 592 | this.executor_ = executor |
| 593 | |
| 594 | /** @private @const */ |
| 595 | this.sync_ = !async |
| 596 | |
| 597 | /** @private @const */ |
| 598 | this.keyboard_ = new Keyboard('default keyboard') |
| 599 | |
| 600 | /** @private @const */ |
| 601 | this.mouse_ = new Pointer('default mouse', Pointer.Type.MOUSE) |
| 602 | |
| 603 | /** @private @const */ |
| 604 | this.wheel_ = new Wheel('default wheel') |
| 605 | |
| 606 | /** @private @const {!Map<!Device, !Array<!Action>>} */ |
| 607 | this.sequences_ = new Map([ |
| 608 | [this.keyboard_, []], |
| 609 | [this.mouse_, []], |
| 610 | [this.wheel_, []], |
| 611 | ]) |
| 612 | } |
| 613 | |
| 614 | /** @return {!Keyboard} the keyboard device handle. */ |
| 615 | keyboard() { |
| 616 | return this.keyboard_ |
| 617 | } |
| 618 | |
| 619 | /** @return {!Pointer} the mouse pointer device handle. */ |
| 620 | mouse() { |
| 621 | return this.mouse_ |
| 622 | } |
| 623 | |
| 624 | /** @return {!Wheel} the wheel device handle. */ |
| 625 | wheel() { |
| 626 | return this.wheel_ |
| 627 | } |
| 628 | |
| 629 | /** |
| 630 | * @param {!Device} device |
| 631 | * @return {!Array<!Action>} |
| 632 | * @private |
| 633 | */ |
| 634 | sequence_(device) { |
| 635 | let sequence = this.sequences_.get(device) |
| 636 | if (!sequence) { |
| 637 | sequence = [] |
| 638 | this.sequences_.set(device, sequence) |
| 639 | } |
| 640 | return sequence |
nothing calls this directly
no outgoing calls
no test coverage detected