Force keyboard layout for Selenium2 sendkeys method

北城余情 提交于 2021-01-28 08:01:27

问题


Is it somehow possible to force Selenium2 webdriver sendkeys method to use specific keyboard layout instead of Windows active one in specific testcase?

The issue I ran into is that my default keyboard layout is "Latvian (apostrophe)" (where apostrophe is pressed before accented letters) and

webdriver.findElement(By.name("lastName")).sendKeys("O'Neill");

is actually entered as "OŅeill" in the field.

P.S. Couldn't find one, but maybe there's some Selenium2 webdriver method for setting field value as a whole without typing?


回答1:


I did not found any solution also. So my solution actually is, that layout default in my system is English and for specific applications (mail) I switch my keyboard manually to layout which I need (Czech in my case)

See my question here on SO: convert at symbol ("@") to CharSequence

I accepted an answer which was providing good hint for workaround, but it was not working 100%



来源:https://stackoverflow.com/questions/14153288/force-keyboard-layout-for-selenium2-sendkeys-method

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!