简体   繁体   English

Casper.js的sendEvent在哪里定义?

[英]Where is Casper.js' sendEvent defined?

I'm trying to figure out how exactly is Casper.js using underlying Phantom.js to move the mouse . 我试图弄清楚Casper.js使用底层的Phantom.js移动鼠标的确切方式。

I found that casper.page.sendEvent() is responsible but where is sendEvent defined and how does it interact with PhantomJS? 我发现casper.page.sendEvent()是负责任的,但是sendEvent在哪里定义以及如何与PhantomJS交互?

Since CasperJS is built on top of PhantomJS, you can use any PhantomJS function inside a CasperJS script through the casper.page object. 由于CasperJS基于PhantomJS构建,因此您可以通过casper.page对象在CasperJS脚本中使用任何PhantomJS函数。

One such function is page.sendEvent which enables you to trigger native user events in PhantomJS. page.sendEvent是这样的功能page.sendEvent ,它使您能够在PhantomJS中触发本机用户事件。

The documentation says the following for mouse move: 该文档说以下鼠标移动:

For 'mousemove', however, there is no button pressed (ie it is not dragging). 但是,对于“ mousemove”,没有按钮被按下(即它没有拖动)。

If you still want to see how it is implemented, you can find it here . 如果您仍然想了解它的实现方式,可以在此处找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM