Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
jsfehler committed Jun 11, 2024
1 parent e9b83e6 commit b420f73
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions splinter/driver/webdriver/keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ def _resolve_key_up_action(self, action_chain: ActionChains, key: str) -> Action
def down(self, key: str) -> 'Keyboard':
""""""
chain = ActionChains(self.driver)
chain = _resolve_key_down_action(chain, key)
chain = self._resolve_key_down_action(chain, key)
chain.perform()
return self

def up(self, key: str) -> 'Keyboard':
""""""
chain = ActionChains(self.driver)
chain = _resolve_key_up_action(chain, key)
chain = self._resolve_key_up_action(chain, key)
chain.perform()
return self

Expand All @@ -54,13 +54,13 @@ def press(self, key: str, delay: int = 0) -> 'Keyboard':
chain = ActionChains(self.driver)

for item in key_pattern:
chain = _resolve_key_down_action(chain, item)
chain = self._resolve_key_down_action(chain, item)

if delay:
chain = chain.pause(delay)

for item in key_pattern:
chain = _resolve_key_up_action(chain, item)
chain = self._resolve_key_up_action(chain, item)

chain.perform()

Expand Down
3 changes: 1 addition & 2 deletions tests/keyboard.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from splinter.driver.webdriver import Keyboard
import pytest


class KeyboardTest:
def test_keyboard_down(self):
Expand All @@ -24,7 +24,6 @@ def test_keyboard_up(self):
def test_keyboard_press(self):
pass


def test_element_press_combo(self):
elem = self.browser.find_by_css("[name='q']")
elem.press("SHIFT+a+BACKSPACE+b")
Expand Down
2 changes: 1 addition & 1 deletion tests/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
addShadowRoot();
}, false);

document.onkeypress = function (e) {
document.onkeydown = function (e) {
if (e.key === "Control") {
$('body').append('<div id="keypress_detect">Added when "Control" key is pressed down.</div>');
}
Expand Down

0 comments on commit b420f73

Please sign in to comment.