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