kandi background
kandi background
Explore Kits
kandi background
Explore Kits
kandi background
Explore Kits
kandi background
Explore Kits
Explore all Selenium open source software, libraries, packages, source code, cloud functions and APIs.

Popular New Releases in Selenium

1.8.2

v1.21.1

Selenium 4.1.0

rrweb@1.1.3; rrweb-player@0.7.14; rrweb-snapshot@1.1.14

v2.1.0

scrapy

1.8.2

playwright

v1.21.1

selenium

Selenium 4.1.0

rrweb

rrweb@1.1.3; rrweb-player@0.7.14; rrweb-snapshot@1.1.14

nightwatch

v2.1.0

Popular Libraries in Selenium

Trending New libraries in Selenium

Top Authors in Selenium

1

43 Libraries

247

2

37 Libraries

657

3

32 Libraries

95

4

31 Libraries

471

5

17 Libraries

58

6

17 Libraries

553

7

13 Libraries

2463

8

12 Libraries

1803

9

12 Libraries

48

10

10 Libraries

78

1

43 Libraries

247

2

37 Libraries

657

3

32 Libraries

95

4

31 Libraries

471

5

17 Libraries

58

6

17 Libraries

553

7

13 Libraries

2463

8

12 Libraries

1803

9

12 Libraries

48

10

10 Libraries

78

Trending Kits in Selenium

No Trending Kits are available at this moment for Selenium

Trending Discussions on Selenium

    Selenium-chromedriver: Cannot construct KeyEvent from non-typeable key
    Python Selenium AWS Lambda Change WebGL Vendor/Renderer For Undetectable Headless Scraper
    How To Set ChromeOptions (or goog:ChromeOptions) for Selenium::Chrome in Perl
    DeprecationWarning: executable_path has been deprecated, please pass in a Service object
    How can I send Dynamic website content to scrapy with the html content generated by selenium browser?
    Python/Selenium web scrap how to find hidden src value from a links?
    Efficient code for custom color formatting in tkinter python
    Unable to build and deploy Rails 6.0.4.1 app on heroku - Throws gyp verb cli error
    Log4j 1: How to mitigate the vulnerability in log4j without updating version to 2.15.0
    TypeError: WebDriver.__init__() got an unexpected keyword argument 'firefox_options' error using firefox_options as arguments in Selenium Python

QUESTION

Selenium-chromedriver: Cannot construct KeyEvent from non-typeable key

Asked 2022-Mar-25 at 12:17

I updated my Chrome and Chromedriver to the latest version yesterday, and since then I get the following error messages when running my Cucumber features:

1....
2unknown error: Cannot construct KeyEvent from non-typeable key
3        (Session info: chrome=98.0.4758.80) (Selenium::WebDriver::Error::UnknownError)
4      #0 0x55e9ce6a4093 <unknown>
5      #1 0x55e9ce16a648 <unknown>
6      #2 0x55e9ce1a9866 <unknown>
7      #3 0x55e9ce1cbd29 <unknown>
8      .....
9

I try to fill a text field with Capybara's fill_in method. While debugging I noticed that Capybara has problems especially with the symbols @ and \. Every other character can be written into the text field without any problems.

The code that triggers the error looks like this

1....
2unknown error: Cannot construct KeyEvent from non-typeable key
3        (Session info: chrome=98.0.4758.80) (Selenium::WebDriver::Error::UnknownError)
4      #0 0x55e9ce6a4093 <unknown>
5      #1 0x55e9ce16a648 <unknown>
6      #2 0x55e9ce1a9866 <unknown>
7      #3 0x55e9ce1cbd29 <unknown>
8      .....
9def sign_in(user)
10  visit new_sign_in_path
11  fill_in 'Email', with: user.email
12  fill_in 'Password', with: user.password
13  click_button 'Sign in'
14end
15

user.email contains a string like "example1@mail.com".

I work with Rails 6.1.3.1, Cucumber 5.3.0, Chromedriver 98.0.4758.48, capybara 3.35.3

The error only occurs on features that are tagged with @javascript

Do you have any ideas what causes this error or how to fix it?

ANSWER

Answered 2022-Feb-03 at 08:25

It seems something has changed in the new version of ChromeDriver and it is no longer possible to send some special chars directly using send_keys method.

In this link you will see how it is solved (in C#) --> Selenium - SendKeys("@") write an "à"

And regarding python implementation, check this out --> https://www.geeksforgeeks.org/special-keys-in-selenium-python/

Specifically, my implementation was (using MAC):

copy icondownload icon

1....
2unknown error: Cannot construct KeyEvent from non-typeable key
3        (Session info: chrome=98.0.4758.80) (Selenium::WebDriver::Error::UnknownError)
4      #0 0x55e9ce6a4093 <unknown>
5      #1 0x55e9ce16a648 <unknown>
6      #2 0x55e9ce1a9866 <unknown>
7      #3 0x55e9ce1cbd29 <unknown>
8      .....
9def sign_in(user)
10  visit new_sign_in_path
11  fill_in 'Email', with: user.email
12  fill_in 'Password', with: user.password
13  click_button 'Sign in'
14end
15driver.find_element('.email-input', 'user@mail.com')
16

Now I had to change it by:

copy icondownload icon

1....
2unknown error: Cannot construct KeyEvent from non-typeable key
3        (Session info: chrome=98.0.4758.80) (Selenium::WebDriver::Error::UnknownError)
4      #0 0x55e9ce6a4093 <unknown>
5      #1 0x55e9ce16a648 <unknown>
6      #2 0x55e9ce1a9866 <unknown>
7      #3 0x55e9ce1cbd29 <unknown>
8      .....
9def sign_in(user)
10  visit new_sign_in_path
11  fill_in 'Email', with: user.email
12  fill_in 'Password', with: user.password
13  click_button 'Sign in'
14end
15driver.find_element('.email-input', 'user@mail.com')
16from selenium.webdriver.common.keys import Keys
17from selenium.webdriver.common.action_chains import ActionChains
18
19emailParts = 'user@mail.com'.split('@')
20emailElement = driver.find_element('.email-input')
21
22emailElement.send_keys(emailParts[0])
23action = ActionChains(driver)
24action.key_down(Keys.ALT).send_keys('2').key_up(Keys.ALT).perform()
25emailElement.send_keys(emailParts[1])
26

Source https://stackoverflow.com/questions/70967207

Community Discussions contain sources that include Stack Exchange Network

    Selenium-chromedriver: Cannot construct KeyEvent from non-typeable key
    Python Selenium AWS Lambda Change WebGL Vendor/Renderer For Undetectable Headless Scraper
    How To Set ChromeOptions (or goog:ChromeOptions) for Selenium::Chrome in Perl
    DeprecationWarning: executable_path has been deprecated, please pass in a Service object
    How can I send Dynamic website content to scrapy with the html content generated by selenium browser?
    Python/Selenium web scrap how to find hidden src value from a links?
    Efficient code for custom color formatting in tkinter python
    Unable to build and deploy Rails 6.0.4.1 app on heroku - Throws gyp verb cli error
    Log4j 1: How to mitigate the vulnerability in log4j without updating version to 2.15.0
    TypeError: WebDriver.__init__() got an unexpected keyword argument 'firefox_options' error using firefox_options as arguments in Selenium Python

QUESTION

Selenium-chromedriver: Cannot construct KeyEvent from non-typeable key

Asked 2022-Mar-25 at 12:17

I updated my Chrome and Chromedriver to the latest version yesterday, and since then I get the following error messages when running my Cucumber features:

1....
2unknown error: Cannot construct KeyEvent from non-typeable key
3        (Session info: chrome=98.0.4758.80) (Selenium::WebDriver::Error::UnknownError)
4      #0 0x55e9ce6a4093 <unknown>
5      #1 0x55e9ce16a648 <unknown>
6      #2 0x55e9ce1a9866 <unknown>
7      #3 0x55e9ce1cbd29 <unknown>
8      .....
9

I try to fill a text field with Capybara's fill_in method. While debugging I noticed that Capybara has problems especially with the symbols @ and \. Every other character can be written into the text field without any problems.

The code that triggers the error looks like this

1....
2unknown error: Cannot construct KeyEvent from non-typeable key
3        (Session info: chrome=98.0.4758.80) (Selenium::WebDriver::Error::UnknownError)
4      #0 0x55e9ce6a4093 <unknown>
5      #1 0x55e9ce16a648 <unknown>
6      #2 0x55e9ce1a9866 <unknown>
7      #3 0x55e9ce1cbd29 <unknown>
8      .....
9def sign_in(user)
10  visit new_sign_in_path
11  fill_in 'Email', with: user.email
12  fill_in 'Password', with: user.password
13  click_button 'Sign in'
14end
15

user.email contains a string like "example1@mail.com".

I work with Rails 6.1.3.1, Cucumber 5.3.0, Chromedriver 98.0.4758.48, capybara 3.35.3

The error only occurs on features that are tagged with @javascript

Do you have any ideas what causes this error or how to fix it?

ANSWER

Answered 2022-Feb-03 at 08:25

It seems something has changed in the new version of ChromeDriver and it is no longer possible to send some special chars directly using send_keys method.

In this link you will see how it is solved (in C#) --> Selenium - SendKeys("@") write an "à"

And regarding python implementation, check this out --> https://www.geeksforgeeks.org/special-keys-in-selenium-python/

Specifically, my implementation was (using MAC):

copy icondownload icon

1....
2unknown error: Cannot construct KeyEvent from non-typeable key
3        (Session info: chrome=98.0.4758.80) (Selenium::WebDriver::Error::UnknownError)
4      #0 0x55e9ce6a4093 <unknown>
5      #1 0x55e9ce16a648 <unknown>
6      #2 0x55e9ce1a9866 <unknown>
7      #3 0x55e9ce1cbd29 <unknown>
8      .....
9def sign_in(user)
10  visit new_sign_in_path
11  fill_in 'Email', with: user.email
12  fill_in 'Password', with: user.password
13  click_button 'Sign in'
14end
15driver.find_element('.email-input', 'user@mail.com')
16

Now I had to change it by:

copy icondownload icon

1....
2unknown error: Cannot construct KeyEvent from non-typeable key
3        (Session info: chrome=98.0.4758.80) (Selenium::WebDriver::Error::UnknownError)
4      #0 0x55e9ce6a4093 <unknown>
5      #1 0x55e9ce16a648 <unknown>
6      #2 0x55e9ce1a9866 <unknown>
7      #3 0x55e9ce1cbd29 <unknown>
8      .....
9def sign_in(user)
10  visit new_sign_in_path
11  fill_in 'Email', with: user.email
12  fill_in 'Password', with: user.password
13  click_button 'Sign in'
14end
15driver.find_element('.email-input', 'user@mail.com')
16from selenium.webdriver.common.keys import Keys
17from selenium.webdriver.common.action_chains import ActionChains
18
19emailParts = 'user@mail.com'.split('@')
20emailElement = driver.find_element('.email-input')
21
22emailElement.send_keys(emailParts[0])
23action = ActionChains(driver)
24action.key_down(Keys.ALT).send_keys('2').key_up(Keys.ALT).perform()
25emailElement.send_keys(emailParts[1])
26

Source https://stackoverflow.com/questions/70967207