Skip to content

Commit

Permalink
add util to fill pause to other devices
Browse files Browse the repository at this point in the history
  • Loading branch information
kkb912002 committed Mar 19, 2024
1 parent 5b7c95b commit 312a34e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions py/selenium/webdriver/common/actions/action_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
# specific language governing permissions and limitations
# under the License.

from typing import Dict
from typing import List
from typing import Literal
from typing import Optional
from typing import Union

Expand Down Expand Up @@ -85,6 +87,17 @@ def add_wheel_input(self, name: str) -> WheelInput:
new_input = WheelInput(name)
self._add_input(new_input)
return new_input

def fill_pause_except(self, type: Literal["key", "pointer", "wheel"], ticks: int = 1) -> None:
actions: Dict[Literal["key", "pointer", "wheel"], Union[KeyActions, PointerActions, WheelActions]] = {
"key": self.key_action,
"pointer": self.pointer_action,
"wheel": self.wheel_action
}
del actions[type]
for action in actions.values():
for _ in range(ticks):
action.pause()

def perform(self) -> None:
enc = {"actions": []}
Expand Down

0 comments on commit 312a34e

Please sign in to comment.