I have run into a situation where I need to click on a js confirmation popup which running WWW::Mechanize::Firefox. I have read through the documentation and I didn't see anything that allows me to do so (I may have missed it). If any one knows a way to get past this it would be greatly appreciated. Here is the code thus far.

#!/usr/bin/perl use warnings; use strict; use WWW::Mechanize::Firefox; use Data::Dumper; my $url = '<my_url>'; my $username = '<username>'; my $password = '<password>'; my $mech = WWW::Mechanize::Firefox->new('ssl_opts'=> {'SSL_verify_mode +'=>0 }, autocheck => 0); $mech->autoclose_tab( 0 ); $mech->get($url); $mech->field(USERNAME => $username); $mech->field(PASSWORD => $password); $mech->click({ xpath => '//*[@id="loginButton"]' }); $mech->click({xpath => '//a[@onclick="changeTab(\'View Auto Attendants +\', \'TelephonyControls\', \'ViewAutoAttendants\');return(false);"]' +}); ### Fails here, obviously because confirmation_is is not a part of the + Mechanize::Firefox module but part of selenium. Would like to use M +echanize if at all possible. $mech->confirmation_is("Click OK to View Auto Attendants, if you have +not saved your work, click Cancel and be sure to save it");

In reply to Clicking on Confirmation Button (JS) using WWW::Mechanize::Firefox by edimusrex

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.