----- Original Message ----- From: "Peter Rabbitson" <[EMAIL PROTECTED]>
To: <beginners@perl.org>
Sent: Thursday, May 05, 2005 6:40 PM
Subject: Re: How to follow a Java script link
On Thu, May 05, 2005 at 11:40:52AM -0500, Sergio Ulises Sanchez Buelna wrote:Hello all
I am trying to harvest a set of information from a search service that gives the results of the search by pages.
I am interested in ALL of the results.
I can activate the search and obtain the first page with results. but when I try to follow the link for the next page I cant do it since the link is a Java script code at the source.
I am using a WWW::Mechanize agent to do this procedure and i have tried
$link = $mech->find_link (text, "mytext")
$link = $mech->find(textregex, qr/myregex/i).....etc
then
$url = $link->url()
and finally
$mech->get ($url)the code does not work not because I am not able to get the link but because the link calls a Java script argument which is then interpreted to generate the next page.
I have also tried the following methods from the WWW::mechanize module
follow_link (this one does not work for the same reason presented before) and
clik_button (this one does not recognize the link as a valid button)
non of them work
The link points to this code
"javascript:mySubmit( 2, 're_search', 25) " on this reference <a href="javascript:mySubmit( 2, 're_search', 25) ">previous</a>
Unfortunately everything is pretty much as Branislav described it - you have
to reverse engineer the java script and make your own perl program behave
just like it (mostly spitting back the right cookies). I went a long way
some time ago to be able to login into a certain site that was entirely java
navigated (took me about 1 week to develop and another to fully debug and
test). Nevertheless the thing works like a charm ever since. If you are
interested this is the discussion on the matter with the resulting code at
the end:
http://www.issociate.de/board/post/180487/WWW::Mechanize_java_navigation.html
Thanks Peter, That will help.
Peter
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>