bucket
bucket

Reputation: 11

Cannot construct KeyEvent from non-typeable key only with special characters, using Selenium-chromedriver

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 "[email protected]". 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('[email protected]')

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

import xerox
username = "[email protected]"
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:

Upvotes: 1

Views: 666

Answers (1)

undetected Selenium
undetected Selenium

Reputation: 193258

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

Upvotes: 2

Related Questions