Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Error when using WWW::Mechanize

by kschwab (Priest)
on Dec 15, 2013 at 15:16 UTC ( #1067237=note: print w/replies, xml ) Need Help??

in reply to Error when using WWW::Mechanize

You have other issues, but this particular one is triggered here:

sub login() { $mech->get($loginPage); $mech->set_visible($email, $pass); # # the original line, below, has double quotes nested # within single quotes # #$mech->click_button('value'=>'"Sign in using our secure server"') +; # no error if you remove them $mech->click_button('value'=>'Sign in using our secure server'); }

For whatever reason, this "Can't call header.." error is what WWW:Mechanize does if you pass a value for a button that doesn't exist in the request to the click_button method. Seems like a bug to me. is. click_button does not check for zero matching inputs. Until that's fixed, you can trap the error yourself:

eval {$mech->click_button('value'=>'does not exist')}; if ($@) { warn("Can't click button\n"); }

Replies are listed 'Best First'.
Re^2: Error when using WWW::Mechanize
by coderman9 (Initiate) on Dec 15, 2013 at 21:34 UTC

    Thanks a bunch. When reading the source code of the page I forgot that they would be using quotation marks also, so I was thinking that the value had the quotation marks in it. Thanks

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1067237]
[Corion]: I think I'm overdesigning things again. I want to export(later, synchronize) data from Google Keep, by scraping the HTML. And I'm thinking of automating this by having a canary note whose text my program knows and from which it can determine the ...
[Corion]: ... surrounding HTML to scrape all the other notes. Maybe I should better look at dumping all the requests that pass between Google and my "browser" instead.

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2017-12-12 08:53 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (327 votes). Check out past polls.