K
K
Konstantin Kuzmenko2015-04-18 17:31:23
Perl
Konstantin Kuzmenko, 2015-04-18 17:31:23

Clicking on blocks ***?

How to click on website buttons using www::mechanize in mozrepl
Firebug shows the button code like this *div*class="uuui-stbutton :float :left*/div*
My attempts to
use strict;
use warnings;
#use WWW:: Mechanize::Firefox::Troubleshooting;
use WWW::Mechanize::Firefox;
use Crypt::SSLeay;
use HTML::TagParser;
use URI::Fetch;
my $url = ' https://site.lobococ/teleport ' ;
my $mech = WWW::Mechanize::Firefox->new( tab => 'current', );
&tevtyav;
sub tevtyav {
$mech->get($url);
sleep 4;
my @buttons = grep { $ mech->is_visible($_) }
$mech->xpath(q{//div[@class="uuui-stbutton"]//a});
$mech->click($buttons[0]);
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kuzmenko, 2015-04-22
@bufonix

Got it :)

#!/usr/bin/perl
use strict;
use warnings;
use WWW::Mechanize::Firefox;

my $mech = WWW::Mechanize::Firefox->new();
#my $id = "google-help";
$mech->get('http://www.youtube.com/');
sleep 10;
$mech->click({ xpath => '//button[@id="google-help"]' });
sleep 10;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question