Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium sendkeys drops character with Chrome Driver

Selenium sendkeys with Chrome Driver drops character "2" and "4". Other characters are OK. When I use other browser (IE or FF), everything is OK.

code:

WebElement name = driver.findElement(localizator);
name.clear();
name.sendKeys("1234567890 abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ");

result: input box is filled with

13567890 abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ

Characters 2 and 4 are missing, other characters are filled correctly.

I use Windows 7 64bit, Chrome version 29.0.1547.57 m, ChromeDriver win32 (v2.2.215849.dyu) - the newest one.

like image 232
Zuzana Rajova Avatar asked Aug 28 '13 08:08

Zuzana Rajova


People also ask

Why sendKeys is not working in Selenium?

sendKeys() not working in Selenium Webdriver Selenium can run JavaScript commands with the help of the executeScript method. JavaScript command to be used is passed as a parameter to this method. To input text we shall first identify the edit field with the JavaScript method document. getElementsByClassName.

How do I pass sendKeys in Selenium WebDriver?

The Selenium Sendkeys() method helps with field auto-completion in two simple steps: Identifying the input fields using specific locators. For example, an email address, password field. Entering values in input boxes explicitly using sendkeys() method.


1 Answers

Investigating you are from Czech Republic also, I am going to make wild assumption, that your keyboard is set up to Czech as default.

I also had some strange issues with sendKeys when my system had Czech keyboard as default one. Since I changed default to English, the problems dissapeared.

If this does not help, please provide info what is going to happen if you try this:

  name.sendKeys("2");
  name.sendKeys("22222222");
  name.sendKeys("4");
  name.sendKeys("44444444");
  name.sendKeys("424242");
like image 126
Pavel Janicek Avatar answered Oct 11 '22 04:10

Pavel Janicek