Re: Javascript and WWW::Mechanize or LWP::UserAgent?

John J Lee <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <Pine.WNT.4.58.0507151830230.644@vernon>
On Thu, 14 Jul 2005, Peter Stevens wrote:

> Under the heading of small serious amounts of work...
>
> I mentioned previously Win32::IE::Mechanize - does anybody have any
> ideas on how to do the same thing with Firefox under Linux?
[...]

Warning: I'm not up-to-date on this, take what I say with a pinch of salt.

I see you want linux, but first a comment about doing this on Windows:

I believe there's a (MS-)COM IWebBrowser2 wrapper of Firefox's XP-COM
interfaces, so *in theory* you should be able to point
Win32::IE::Mechanize at that under Windows.  I wouldn't be at all
surprised if it were much harder than it should be, though (due to the
complexities of COM, XP-COM and Firefox rather than the Perl side
particularly)...  Also, note the comment below about XP-COM only
supporting in-process clients -- not sure exactly how one does things,
given this.

Under linux, I guess you'd have to do one of:

1. Extend the Perl module to interface with XP-COM direct (note XP-COM,
unlike COM, is in-process only IIUC, so I guess you have to rebuild
Firefox with your new code, which may be a "wonderful learning
experience", even if you *are* a battle-hardened C++ veteran ;-)

2. Build Perl support into Firefox.  I don't know if such functionality
still exists in Firefox (there used to at least some support for Perl, but
I have a feeling that was a long time ago, not sure if it's still there...
Also, I don't know if it allowed external processes to talk to the
browser.

3. Forget Perl and just write what you want in JavaScript.  Not ideal, I
know, but practical: obviously JS support is excellent in Firefox.  See
Selenium for inspiration.


John
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.