問題描述
帶有 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
字符2
和4
缺失,其他字符填寫正確.
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 驅動程序丟棄字符的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!