Timboh56 has asked for the wisdom of the Perl Monks concerning the following question:

, I'm a bit of a newbie to perl. I am trying to use Win32::IE::Mechanize for a data extraction script. The web application it accesses uses a hefty amount of javascript and frames, and Mechanize seems to be unable to detect any of the javascript links on the app.

I was wondering whether there was any easier solution (any modules), I've tried IEautomation but that didn't work (gave me different errors) My code is as follows, but is unable to follow the link.

use Win32::IE::Mechanize; my $mech = Win32::IE::Mechanize->new( visible => 1); $mech->get(URL); sleep(3); my @links = $mech->links(); $mech->follow_link( text => "ServiceModel");

Mechanize is unable to pull any of the links, and it @links remains uninitialized.

The link, as it appears on the web app, looks like this, and is an image <TD class=Expander><A name=#ServiceModel><IMG id=ServiceModel onclick=compandTree(this) src="URL/images/tree.plus.gif"></A></TD>

Now I realize that my follow link method shouldn't work, because the link is an image, but either way, shouldn't mechanize be able to pull all links with the links() method, regardless of whether it is an image link, image link, etc?

Replies are listed 'Best First'.
Re: Problem with Win32 IE Mechanize
by Anonymous Monk on Jun 15, 2011 at 16:24 UTC
      EDIT: OK , I used the $mech->agent()->Document->getElementbyID stuff, it seems to work, until I get to the final "link" i have to click.

      <TD class=ClickMe vAlign=center>SuccessRate</TD>

      How could I isolate this element by the text "SuccessRate"? Please note that there are many tags with the class name ClickMe.