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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With