diff --git a/splinter/driver/webdriver/__init__.py b/splinter/driver/webdriver/__init__.py index 0e4f386ed..62b12a3d5 100644 --- a/splinter/driver/webdriver/__init__.py +++ b/splinter/driver/webdriver/__init__.py @@ -803,7 +803,7 @@ def press(self, key: str, delay: int = 0) -> None: for item in key_pattern: # If in selenium keys, use it, if not, assume literal. - key_value = getattr(Keys, item) + key_value = getattr(Keys, item, None) if key_value: chain = chain.key_down(key_value, self._element) @@ -815,7 +815,7 @@ def press(self, key: str, delay: int = 0) -> None: for item in key_pattern: # If in selenium keys, use it, if not, assume literal. - key_value = getattr(Keys, item) + key_value = getattr(Keys, item, None) if key_value: chain = chain.key_up(key_value, self._element) diff --git a/splinter/driver/webdriver/keyboard.py b/splinter/driver/webdriver/keyboard.py index fcaecd797..38008f396 100644 --- a/splinter/driver/webdriver/keyboard.py +++ b/splinter/driver/webdriver/keyboard.py @@ -27,7 +27,7 @@ def press(self, key: str, delay: int = 0) -> None: for item in key_pattern: # If in selenium keys, use it, if not, assume literal. - key_value = getattr(Keys, item) + key_value = getattr(Keys, item, None) if key_value: chain = chain.key_down(key_value) # , self._element) @@ -39,7 +39,7 @@ def press(self, key: str, delay: int = 0) -> None: for item in key_pattern: # If in selenium keys, use it, if not, assume literal. - key_value = getattr(Keys, item) + key_value = getattr(Keys, item, None) if key_value: chain = chain.key_up(key_value) # , self._element)