刺激浏览器调用javascript事件? [英] Tricking browser into calling javascript events?
问题描述
所以我试图创建一个网络蜘蛛。我遇到一个网站,有一些javascript,我想欺骗浏览器认为事件被触发,它必须调用相应的JavaScript代码来处理事件。我如何能够在Perl中做到这一点?使用WWW :: Mechanize或WWW :: Scripter :: Plugin :: Javascript?
So i'm trying to create a web spider. I've run into a website, that has some javascript, and I want to trick the browser into thinking that an event has been fired and that it must call the corresponding javascript code to handle the event. How would I be able to do this in Perl? using the WWW::Mechanize or WWW::Scripter::Plugin::Javascript?
此外,非常感谢我有人可以提出一个如何使用 WWW :: Scripter :: Plugin :: Javascript 。
Also, it would be very appreciated I someone could put up an example of how to use WWW::Scripter::Plugin::Javascript.
提前感谢。另外,如果有人有更好的方式来解决问题,请继续编辑
Thanks in advance. Also if someone has a better way to word the question please go ahead and edit it
推荐答案
在正常的浏览器设置中,JavaScript在浏览器中,而不是在服务器上。这是执行JavaScript的客户端。
In a normal browser setup, the JavaScript is in the browser, not on the server. It's the client that executes the JavaScript.
这意味着您需要手动弄清楚什么是JavaScript代码,并在Perl中编写代码,或者需要加载JavaScript引擎。
That means you need manually figure out what the JavaScript code does and code that in Perl, or you need to load a JavaScript engine.
以下是三个JavaScript引擎:
Here are three JavaScript engines:
- WWW::Mechanize::Firefox
- Win32::IE::Mechanize
- WWW::Scripter::Plugin::JavaScript
这篇关于刺激浏览器调用javascript事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!