Chrome浏览器驱动程序使用Selenium sendkeys功能 [英] Selenium sendkeys drops character with Chrome Driver

查看:1490
本文介绍了Chrome浏览器驱动程序使用Selenium sendkeys功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Chrome驱动程序的Selenium sendkeys会丢弃字符2和4。其他字符都可以。当使用其他浏览器(IE或FF)时,一切正常。



code:

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

结果:输入框填写
<$

字元 2

13567890 abcdefghijklmnopqrstuvwxyz 和 4 缺失,其他字符填写正确。



我使用Windows 7 64bit,Chrome版本29.0.1547.57米,ChromeDriver win32(v2.2.215849.dyu) - 最新版本。 解决方案

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

当我的系统使用捷克键盘作为默认键盘时,我也遇到了一些与 sendKeys 有关的奇怪问题。因为我将默认值改为英文,所以问题消失了。



如果这样做没有帮助,请提供信息如果您尝试这样做会发生什么情况:

  name.sendKeys(2); 
name.sendKeys(22222222);
name.sendKeys(4);
name.sendKeys(44444444);
name.sendKeys(424242);


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.

解决方案

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

这篇关于Chrome浏览器驱动程序使用Selenium sendkeys功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆