use WWW::Mechanize::FireFox; use Data::Dumper; use strict; use warnings; my $ipaddr = '192.168.0.72'; my $mech = WWW::Mechanize::FireFox->new(); $mech->get('http://' . $ipaddr . '/advanced.html'); my @confirm_text; $mech->eval_in_page('confirm("Testing...");', { confirm => sub { push @confirm_text, @_; return 1; } } ); #~ print "building tree:\n"; #~ binmode STDOUT; #~ $mech->tree; print "about to click button:\n"; binmode STDOUT; $mech->click('facotry'); print "clicked, sleeping...\n"; binmode STDOUT; sleep 5; print Dumper(\@confirm_text); binmode STDOUT; sleep 60; # prevent the tab from being closed for a while