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

Selenium sendkeys drops character with Chrome Driver(Selenium sendkeys 使用 Chrome 驱动程序丢弃字符)
本文介绍了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");

这篇关于Selenium sendkeys 使用 Chrome 驱动程序丢弃字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!
NDK

相关文档推荐

Get the pointer of a Java ByteBuffer though JNI(通过 JNI 获取 Java ByteBuffer 的指针)
Thread interrupt vs. JNI Function Call(线程中断与 JNI 函数调用)
Create, populate and return 2D String array from native code (JNI/NDK)(从本机代码 (JNI/NDK) 创建、填充和返回二维字符串数组)
Passing pointer from C to Java becomes NULL(将指针从 C 传递到 Java 变为 NULL)
Where does Delphi/Android search for a native language library?(Delphi/Android 在哪里搜索本地语言库?)
Message quot;org.openqa.selenium.InvalidSelectorException: invalid selector: Unable to locate an element with the XPath expressionquot; using sendKeys(消息“org.openqa.selenium.InvalidSelectorException:无效选择器:无法使用 XPath 表达式定位元素使用发送键)