MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / KeyInput

Class KeyInput

py/selenium/webdriver/common/actions/key_input.py:22–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20
21
22class KeyInput(InputDevice):
23 def __init__(self, name: str) -> None:
24 super().__init__()
25 self.name = name
26 self.type = interaction.KEY
27
28 def encode(self) -> dict:
29 return {"type": self.type, "id": self.name, "actions": [acts.encode() for acts in self.actions]}
30
31 def create_key_down(self, key) -> None:
32 self.add_action(TypingInteraction(self, "keyDown", key))
33
34 def create_key_up(self, key) -> None:
35 self.add_action(TypingInteraction(self, "keyUp", key))
36
37 def create_pause(self, pause_duration: float = 0) -> None:
38 self.add_action(Pause(self, pause_duration))
39
40
41class TypingInteraction(Interaction):

Calls

no outgoing calls