I'm trying to automate reporting of song usage on a website, but can't even get WWW::Mechanize::PhantomJS to click the "SIGN IN" button by id. The code doesn't fail with any errors, but I can see it hasn't worked by rendering the page to a PNG file then manually viewing it. Here's my code so far:
The ccli_login.png file ends up containing the login screen with my email and password filled in, as if "SIGN IN" hasn't been clicked yet.use WWW::Mechanize::PhantomJS; my $mech = WWW::Mechanize::PhantomJS->new(); $mech->get('https://profile.ccli.com/account/signin?appContext=OLR&ret +urnUrl=https%3A%2F%2Freporting.ccli.com%2F'); $mech->field( EmailAddress => 'me@test.com' ); $mech->field( Password => 'mypw' ); # This doesn't seem to work $mech->click_button( id => 'sign-in' ); # Each of these didn't work either, so I've commented them out #$mech->click_button( number => 1 ); #$mech->click({ xpath => '//button' }); #$mech->submit_form(); # This didn't work either, so I've commented it out #$mech->submit_form( # with_fields => { # EmailAddress => 'me@test.com', # Password => 'mypw' # } #); $mech->render_content( format => 'png', filename => 'ccli_login.png' );
Any ideas what I'm doing wrong? Feel free to experiment with any email address & password you like. It should give an error like "Email or password not found. ...etc..." if your code is able to click the "SIGN IN" button.
I'm running WWW::Mechanize::PhantomJS 0.24 and phantomjs 2.1.1.
Thanks.
tel2
In reply to WWW::Mechanize::PhantomJS can't click button by tel2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |