use warnings; use strict; use Log::Log4perl qw(:easy); use WWW::Mechanize::Chrome; Log::Log4perl->easy_init($ERROR); my $html = <<'HTML'; Testing HTML my $m = WWW::Mechanize::Chrome->new( autoclose => 0, ); $m->update_html($html); my $button = $m->selector('#test-button', single => 1); print "Clicking on button with content:" . $button->get_attribute('innerHTML'); print "\n"; $m->sleep(1); $m->click({ dom => $button }); # Or, all in one go $m->sleep(1); $m->click({ selector => '#test-button' }); $m->sleep(10);