1

When I send keys by selenium which contains special characters such as '@' I got back this error:

Cannot construct KeyEvent from non-typeable key

However, with alphabet characters, the function .send_keys() works. I would like to send my username to the Squarespace login page as "foo@email.com". I have tried using Chrome, Safari, Firefox as the webdriver and the same error appears on all cases.

Replicable code example:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome()
url = "https://login.squarespace.com/"
driver.get(url)
email_but = driver.find_element_by_name("email")
email_but.send_keys('foo@email.com')

I tried to go around the error by copying into the clipboard and then pasting onto the field:

import xerox
username = "foo@email.com"
xerox.copy(username)
email_but = driver.find_element_by_name("email")
email_but.click()
email_but.send_keys(Keys.CONTROL, 'v')

But the same error appears.

I am currently using:

  • OSX v.12.0.1
  • Chromedriver v.98.0.4758.80
  • Chrome v.98.0.4758.80
  • Safari v.15.1
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
bucket
  • 11
  • 1

1 Answers1

2

This error message...

Cannot construct KeyEvent from non-typeable key

...using ChromeDriver v98 is the result of the following regression:

Issue 3999: Executing a sendKeys(Keys.chord()) results in extra symbol character prefixed to inputted text using Chrome / driver 98

while trying to address the non-BMP issue:

Issue 2269: Impossible to use non-BMP characters (code points above U+FFFF).

However, the CL have been Revert "WebDriver supports non-BMP characters in SendKeys" but was blocked due to Issue 1295243: Regression in ChromeDriver sendKeys


Fix availability

The fix is verified and would be released with ChromeDriver v98.0.4758.99 and ChromeDriver v99.0.4844.29.


Alternative

As an alternative, you can also use v98.0 with ChromeDriver v97.0

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352