I want to simulate ctrl keydown and ctrl keyup.
My use-case is the following:
The user can select from a list (build with a table) multiple elements by pressing CTRL key and clicking on the desired row. When the CTRL key is released an AJAX call will be made.
I need a watir test to simulate this. How can i do this ? Any ideas ? I would need a solution that works under Linux
Thanks a lot.
I believe the best way to send comands would be to do the following:
require 'watir-webdriver'
browser.send_keys[:control].send_keys[: arrow_up]
browser.send_keys[:control].send_keys[: arrow_down]
If you want to check out some more key options here is a link:
Link to other key stroke options
Hope this helps!
Realising this is old, but the original question didn't quite get answered, the way I have completed this is to do:
browser.a.click(:control)
If you are on a mac system you may want to use :command.
See http://watir.com/guides/special-keys/
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