Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Mechanize clicking unnamed button

by bcdeery (Novice)
on Jul 13, 2006 at 16:18 UTC ( [id://560998]=note: print w/replies, xml ) Need Help??


in reply to Re: Mechanize clicking unnamed button
in thread Mechanize clicking unnamed button

Update: I'm using WWW::Mechanize. Other than Java support, is there much difference in the two? Here is my code:
#set initital webpage $url="http://www.fedex.com/ratefinder/home?cc=US&language=en&link=1&li +d=//Ship//Pack+Rates+Corp"; #open initial webpage my $mech = WWW::Mechanize->new(); $mech->get($url); while($line=<ZIPPAIRS>){ $indexForm2 = "standAloneActionForm"; $mech->form_name($indexForm2) ; chomp $line; ($Ozip, $Dzip)= split("\t",$line); print " $Dzip $Ozip\n"; #enter the zip codes and package weight of 3 lbs $mech->set_fields( origZip => $Ozip, destZip => $Dzip, totalPackageWeight =>"3", ); $mech->click_button(number=>3); #print current URL's html code to file 2 my $results_html = $mech->content; print OUTFILEB $results_html; die "All Done.\n";
nothing prints to the file. I had $mech->click_button( value=>'Get Transit Time'); in where you had suggested to try using the button number. When I try the button number, I get an error "Can't call method "click" on an undefined value..... Sorry, I'm not very good with the boards. I have only used them a few times and haven't been on in over 6 months.

Replies are listed 'Best First'.
Re^3: Mechanize clicking unnamed button
by marto (Cardinal) on Jul 13, 2006 at 16:38 UTC
    bcdeery,

    I answered a similar question you asked a while back, explaining how to reverse engineer JavaScript. A quick look at the Win32::IE::Mechanize documentation will explain what the differences are between WWW::Mechanize and Win32::IE::Mechanize. Your post history seems to centre around the area of site scraping and processing. A quick look at your target site, in this case www.fedex.com suggests that you may want to check out Section 2. Use of fedex.com. from their Terms of service, which is something you may want to consider:

    "The use of automated dial-in or inquiry devices to obtain information through fedex.com is strictly prohibited."

    For this reason I won't be providing any more information over and above what has already been provided to you.

    Thanks

    Martin

      Good thing he used www.fedex.com and not fedex.com ;)

      (While the ToS doesn't cover www.fedex.com or the FedEx ship manager at www.fedex.com, using an automated agent to collect info from these violates the spirit of the ToS. Also, they can change the ToS at any time to fix this omission.)

        Also your reading their ToS is against the same section of the ToS itself as it says that you can use their webpage only for the purpose of interacting with FedEx as a (potential) customer of theirs. (Even more riddiculous is a site that prohibits deep linking as you can't prove this to anyone else without deep linking to its site.)

      Hey Martin, I appreciate the help you've given me and REALLY appreciate pointing out the Terms of Service. I was not aware of this. I thought I had looked for a robots.txt in the past and found nothing the matter of scraping. I guess I will need to go a different route. Maybe I can convince my account rep to do something useful for a change. And I apologize for asking redundant questions, but this is the only place I have to learn other than the horrible book I picked up. This is only the third program I've tried writing. I'm not an expert---I'm not even a programmer.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-24 03:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found