|
16 | 16 | # under the License. |
17 | 17 | from . import interaction |
18 | 18 | from .input_device import InputDevice |
| 19 | +from typing import Union |
19 | 20 |
|
20 | 21 | from selenium.webdriver.remote.webelement import WebElement |
21 | 22 |
|
22 | 23 |
|
23 | 24 | class WheelInput(InputDevice): |
24 | 25 |
|
25 | | - def __init__(self, name): |
| 26 | + def __init__(self, name) -> None: |
26 | 27 | super().__init__(name=name) |
27 | 28 | self.name = name |
28 | 29 | self.type = interaction.WHEEL |
29 | 30 |
|
30 | | - def encode(self): |
| 31 | + def encode(self) -> dict: |
31 | 32 | return {"type": self.type, |
32 | 33 | "id": self.name, |
33 | 34 | "actions": [acts for acts in self.actions]} |
34 | 35 |
|
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: |
36 | 38 | if isinstance(origin, WebElement): |
37 | 39 | 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}) |
39 | 43 |
|
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