http://www.perlmonks.org?node_id=1182086

edimusrex has asked for the wisdom of the Perl Monks concerning the following question:

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");