Selenium sendkeys 使用 Chrome 驱动程序丢弃字符

带有 Chrome 驱动程序的 Selenium sendkey 会丢弃字符2"和4".其他字符正常.当我使用其他浏览器(IE 或 FF)时,一切正常.

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.

代码:

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

结果:输入框被填满

13567890 abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ

字符24缺失,其他字符填写正确.

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

我使用的是 Windows 7 64bit,Chrome 版本 29.0.1547.57 m,ChromeDriver win32 (v2.2.215849.dyu) - 最新版本.

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

推荐答案

调查你也来自捷克共和国,我会做出疯狂的假设,你的键盘默认设置为捷克语.

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

当我的系统默认使用捷克语键盘时,sendKeys 也有一些奇怪的问题.由于我将默认设置更改为英文,问题就消失了.

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");

相关文章