Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Win32::IEAutomation click link help

by Anonymous Monk
on Dec 23, 2011 at 00:25 UTC ( [id://944876]=note: print w/replies, xml ) Need Help??


in reply to Win32::IEAutomation click link help

So what happens, what errors are generated, what objects are returned ...

site:perlmonks.org IEAutomation getLink Click -> How to click "onclick" link by IEAutomation?, Win32::IE:: Mechanize click_button; no form

IEAutomation is nice, but its still just OLE at the mercy of microsoft

See these win32 tutorials/examples

update: I'm no expert on HTML, but AFAIK, the onClick attribute doesn't take URIs, even URIs of the "javascript:..." type URIs, so that could never work, garbage in, garbage out

  • Comment on Re: Win32::IEAutomation click link help

Replies are listed 'Best First'.
Re^2: Win32::IEAutomation click link help
by Anonymous Monk on Dec 23, 2011 at 11:51 UTC

    An additional problem with the html , since Win32::IEAutomation::getLink uses  $agent->Document->links, but InternetExplorer.Application doesn't consider an A element without a href attribute a link, its not listed under  ->links.

    The DOM method getElementById() will find it , but naturally it won't do anything, since "javascript:" in an onclick attribute is an error

Re^2: Win32::IEAutomation click link help
by mmittiga17 (Scribe) on Dec 23, 2011 at 15:25 UTC

    I get this error: Can't call method "Click" on an undefined value at C:\lab\nbt3.pl line 56. and it does not show up as a link due to no href tag. I will check the additional information you provided links to. thanks!

      found solution by editing the the win32::IEAutomaiton module. addeded the below.

      sub getLink2{ my ($self, $how, $what) = @_; my $agent = $self->{agent}; #my $links = $agent->Document->links; my $links = $agent->Document->all->tags("a"); my $target_link = __getObject($links, $how, $what) if ($links); my $link_object; if ($target_link){ $link_object = Win32::IEAutomation::Element->new(); $link_object->{element} = $target_link; $link_object->{parent} = $self; }else{ $link_object = undef; print "WARNING: No link is present in the document with your +specified option $how $what\n" if $warn; } return $link_object; }
        thank you very much for posting your solution. I would have been stuck without this.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://944876]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-04-16 18:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found