sending ctrl+c using sendkeys in ruby

送分小仙女□ 提交于 2019-12-06 14:13:43

Try this:

wsh.SendKeys("^C")

In the MSDN SendKeys Method specifies the following characters for this keys:

SHIFT: +

CTRL: ^

ALT: %

Examples:

wsh.SendKeys("+{TAB}") # SHIFT+TAB

wsh.SendKeys("^V")     # CTRL+V

wsh.SendKeys("%{F4}")  # ALT+F4

Key combinations can be sent by putting the keys into an array.

text_field.send_keys [ :shift, 'a']

puts a 'A' into the text_field. In your example,

wsh1.send_keys [ :control, 'c']

should work.

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