[英]How to do keypress of “@” in CasperJS
I am trying to do the following: 我正在尝试执行以下操作:
page.sendEvent('keypress', page.event.key['N'], null, null, 0)
page.sendEvent('keypress', page.event.key['@'], null, null, 0)
But the @
symbol is not working. 但是
@
符号不起作用。 How would I enter in @
in the above? 我该如何在上面输入
@
?
Here is the event I am trying to use: http://phantomjs.org/api/webpage/method/send-event.html 这是我要使用的事件: http : //phantomjs.org/api/webpage/method/send-event.html
"@" and "N" are normal characters on the keyboard so you can simply pass them as string: “ @”和“ N”是键盘上的普通字符 ,因此您只需将它们作为字符串传递即可:
page.sendEvent('keypress', 'N');
page.sendEvent('keypress', '@');
or even 甚至
page.sendEvent('keypress', 'N@');
Since you're not setting any modifier, you can remove the optional values of sendEvent()
. 由于未设置任何修饰符,因此可以删除
sendEvent()
的可选值。
Have you tried: 你有没有尝试过:
// https://github.com/ariya/phantomjs/commit/cab2635e66d74b7e665c44400b8b20a8f225153a#diff-e52366857ac302b6d40c78a058758a0aR358
page.sendEvent('keypress', page.event.key['At'], null, null, 0);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.