selenium keyPress
I'm wondering how to use selenium's keyPress function to key in a string, it's easy to key a single character as:
selenium.keyPress("id=textbox", "\\119") (which is character 'w');
but how can i key in an 开发者_运维问答string say, 'face'? the following code would work but ugly:
selenium.keyPress("id=textbox", "\\102") (which is character 'f');
selenium.keyPress("id=textbox", "\\97") (which is character 'a');
selenium.keyPress("id=textbox", "\\99") (which is character 'c');
selenium.keyPress("id=textbox", "\\101") (which is character 'e');
and this one wont' work:
selenium.keyPress("id=textbox", "\\102\\97\\99\\101")
Try using "typeKeys(id=textbox,face)
".
Or if you want to do it in fast you can use type
and for last char you can use keyPress
to initiate the the key press event.
Tried the type command? | type | //input[@name='searchTerms'] | test |
精彩评论