Skip to content

Commit dfc39b5

Browse files
fixed error for source type
1 parent dc3346b commit dfc39b5

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

py/selenium/webdriver/common/actions/key_actions.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from __future__ import annotations
1818

1919
from ..utils import keys_to_typing
20-
from .interaction import KEY, Interaction
20+
from .interaction import KEY, POINTER, WHEEL, Interaction
2121
from .key_input import KeyInput
2222
from .pointer_input import PointerInput
2323
from .wheel_input import WheelInput
@@ -28,7 +28,19 @@ def __init__(self, source: KeyInput | PointerInput | WheelInput | None = None) -
2828
if source is None:
2929
source = KeyInput(KEY)
3030
self.input_source = source
31-
super().__init__(KEY)
31+
32+
# Determine the correct source type string based on the input object
33+
if isinstance(source, KeyInput):
34+
source_type = KEY
35+
elif isinstance(source, PointerInput):
36+
source_type = POINTER
37+
elif isinstance(source, WheelInput):
38+
source_type = WHEEL
39+
else:
40+
source_type = KEY # fallback
41+
42+
super().__init__(source_type)
43+
3244

3345
def key_down(self, letter: str) -> KeyActions:
3446
return self._key_action("create_key_down", letter)

0 commit comments

Comments
 (0)