A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/seleniumhq/selenium/commit/14b1befba0befdd515f8bef278fee3800e85527f below:

Additional type hinting for `actions` · SeleniumHQ/selenium@14b1bef · GitHub

File tree Expand file treeCollapse file tree 6 files changed

+16

-7

lines changed

Filter options

Expand file treeCollapse file tree 6 files changed

+16

-7

lines changed Original file line number Diff line number Diff line change

@@ -14,6 +14,8 @@

14 14

# KIND, either express or implied. See the License for the

15 15

# specific language governing permissions and limitations

16 16

# under the License.

17 +

from __future__ import annotations

18 + 17 19

from ..utils import keys_to_typing

18 20

from .interaction import KEY

19 21

from .interaction import Interaction

@@ -44,7 +46,7 @@ def send_keys(self, text):

44 46

self.key_up(letter)

45 47

return self

46 48 47 -

def _key_action(self, action, letter):

49 +

def _key_action(self, action, letter) -> KeyActions:

48 50

meth = getattr(self.source, action)

49 51

meth(letter)

50 52

return self

Original file line number Diff line number Diff line change

@@ -35,7 +35,7 @@ def create_key_down(self, key) -> None:

35 35

def create_key_up(self, key) -> None:

36 36

self.add_action(TypingInteraction(self, "keyUp", key))

37 37 38 -

def create_pause(self, pause_duration=0) -> None:

38 +

def create_pause(self, pause_duration: float = 0) -> None:

39 39

self.add_action(Pause(self, pause_duration))

40 40 41 41 Original file line number Diff line number Diff line change

@@ -194,7 +194,7 @@ def double_click(self, element=None):

194 194

self.pointer_up(MouseButton.LEFT)

195 195

return self

196 196 197 -

def pause(self, duration=0):

197 +

def pause(self, duration: float = 0):

198 198

self.source.create_pause(duration)

199 199

return self

200 200 Original file line number Diff line number Diff line change

@@ -35,7 +35,14 @@ def __init__(self, kind, name):

35 35

self.kind = kind

36 36

self.name = name

37 37 38 -

def create_pointer_move(self, duration=DEFAULT_MOVE_DURATION, x=0, y=0, origin=None, **kwargs):

38 +

def create_pointer_move(

39 +

self,

40 +

duration=DEFAULT_MOVE_DURATION,

41 +

x: float = 0,

42 +

y: float = 0,

43 +

origin: typing.Optional[WebElement] = None,

44 +

**kwargs,

45 +

):

39 46

action = {"type": "pointerMove", "duration": duration, "x": x, "y": y, **kwargs}

40 47

if isinstance(origin, WebElement):

41 48

action["origin"] = {"element-6066-11e4-a52e-4f735466cecf": origin.id}

@@ -53,7 +60,7 @@ def create_pointer_up(self, button):

53 60

def create_pointer_cancel(self):

54 61

self.add_action({"type": "pointerCancel"})

55 62 56 -

def create_pause(self, pause_duration):

63 +

def create_pause(self, pause_duration: float) -> None:

57 64

self.add_action({"type": "pause", "duration": int(pause_duration * 1000)})

58 65 59 66

def encode(self):

Original file line number Diff line number Diff line change

@@ -24,7 +24,7 @@ def __init__(self, source: WheelInput = None):

24 24

source = WheelInput("wheel")

25 25

super().__init__(source)

26 26 27 -

def pause(self, duration=0):

27 +

def pause(self, duration: float = 0):

28 28

self.source.create_pause(duration)

29 29

return self

30 30 Original file line number Diff line number Diff line change

@@ -73,5 +73,5 @@ def create_scroll(self, x: int, y: int, delta_x: int, delta_y: int, duration: in

73 73

}

74 74

)

75 75 76 -

def create_pause(self, pause_duration: Union[int, float]) -> None:

76 +

def create_pause(self, pause_duration: float) -> None:

77 77

self.add_action({"type": "pause", "duration": int(pause_duration * 1000)})

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4