Press "Enter" to skip to content


如果用greaseMonkey编写脚本来做一些Web自动化的事情, 最关键的点会是哪里呢?
试想, 如果一定按钮, 点击以后, 触发了一系列的动作,
如果使用脚本去实现自动化, 那么我们必须去寻找这一系列的动作, 然后找到切入点函数, 模拟参数, 调用. 这会是个很复杂的过程...
但是, 如果我们采用"模拟浏览器事件"的方式, 只要简单的模拟下点击动作, 那些一系列的动作, 我们都可以不关心, 那不是很高效, 也很简单么?

对于IE来讲, 模拟动作有俩套方式:
1. 是IHTMLELEMENT2 提供的事件方法, 比如 click(), blur().
2. 是IHTMLELEMENT3 提供的fireEvent, 事件现场可以使用IHTMLDocument4::createEventObject来模拟
对于FF来讲, 则可以使用Gecko DOM中的createEvent, dispatchEvent.
对于IE来讲, 使用事件方法(以下简称A)和fireEvent(以下简称B)的区别主要有:
1. 使用B的话, 只是发出事件, 不会模拟发送事件之前的浏览器动作, 比如对于focus():
使用A会讲焦点送到事件调用对象上, 而使用B并不会真正的讲焦点送到事件发送对象上.


  1. darell
    darell October 20, 2019


  2. Best coursework writing
    Best coursework writing July 10, 2018

    PHP extensions are incorporated libraries which empower particular capacities to be utilized as a part of your PHP code. For instance, you need to collaborate with MySQL utilizing PHP. You can actualize your own strategies to interface with MySQL server, make inquiries utilizing TCP/IP convention. Anyway that is not a unimportant errand. Additionally, that isn’t just your own particular necessity, however different engineers likewise need to do comparable thing.

  3. guest
    guest September 13, 2009

    by Fatal error: Maximum execution time of 60 seconds exceeded in d:\clientweb\laruence\wwwroot\wp-includes\feed-rss2.php on line 37
    from google reader.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.