Hi Monks,

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:

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' );
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.

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.