Skip to content

Commit 60db0c1

Browse files
[py] PEP 484 type hints for selenium.webdriver.common.actions (#10103)
Co-authored-by: David Burns <[email protected]>
1 parent c188fe8 commit 60db0c1

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

py/selenium/webdriver/common/actions/wheel_input.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,31 @@
1616
# under the License.
1717
from . import interaction
1818
from .input_device import InputDevice
19+
from typing import Union
1920

2021
from selenium.webdriver.remote.webelement import WebElement
2122

2223

2324
class WheelInput(InputDevice):
2425

25-
def __init__(self, name):
26+
def __init__(self, name) -> None:
2627
super().__init__(name=name)
2728
self.name = name
2829
self.type = interaction.WHEEL
2930

30-
def encode(self):
31+
def encode(self) -> dict:
3132
return {"type": self.type,
3233
"id": self.name,
3334
"actions": [acts for acts in self.actions]}
3435

35-
def create_scroll(self, x, y, delta_x, delta_y, duration, origin):
36+
def create_scroll(self, x: int, y: int, delta_x: int,
37+
delta_y: int, duration: int, origin) -> None:
3638
if isinstance(origin, WebElement):
3739
origin = {"element-6066-11e4-a52e-4f735466cecf": origin.id}
38-
self.add_action({"type": "scroll", "x": x, "y": y, "deltaX": delta_x, "deltaY": delta_y, "duration": duration, "origin": origin})
40+
self.add_action({"type": "scroll", "x": x, "y": y, "deltaX": delta_x,
41+
"deltaY": delta_y, "duration": duration,
42+
"origin": origin})
3943

40-
def create_pause(self, pause_duration):
41-
self.add_action({"type": "pause", "duration": int(pause_duration * 1000)})
44+
def create_pause(self, pause_duration: Union[int,float]) -> None:
45+
self.add_action(
46+
{"type": "pause", "duration": int(pause_duration * 1000)})

0 commit comments

Comments
 (0)