开发者

Where can I find numeric keycodes to use with keyPress command in Selenium?

At http://release.seleniumhq.org/selenium-core/1.0.1/reference.html there's description of keySequence parameter to keyPress command:

Either be a string("\" followed by the numeric keycode of the key to be pressed, normally the ASCII value of that key), or a single character. For开发者_运维百科 example: "w", "\119".

Nevertheless there's no information on where to look for numeric keycodes to use...


http://aspdotnetfaq.com/Faq/What-is-the-list-of-KeyCodes-for-JavaScript-KeyDown-KeyPress-and-KeyUp-events.aspx

This works for me


What you need are the ascii codes of the number characters, as an example, see the following page:

http://www.asciitable.com/

The numbers go from \48 (0) to \57 (9).


The modules have objects/variables for the common keys, e.g.:

Ruby: http://www.google.com/codesearch#2tHw6m3DZzo/trunk/rb/lib/selenium/webdriver/common/keys.rb Python: http://www.google.com/codesearch#2tHw6m3DZzo/trunk/py/selenium/webdriver/common/keys.py Java: http://www.google.com/codesearch#2tHw6m3DZzo/trunk/java/client/src/org/openqa/selenium/Keys.java

I believe these mappings include most of the special keys you're looking for?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜