- Make sure to change YOURXISERVER, USERNAME, and PASSWORD
Code: Select all
use strict;
use warnings;
use Time::HiRes qw(sleep);
use Test::WWW::Selenium;
use Test::More "no_plan";
use Test::Exception;
use TimePerf2;
my $time= TimePerf2->new(60,90,120);
my $sel = Test::WWW::Selenium->new( host => "192.168.136.134",
port => 4444,
browser => "*firefox",
browser_url => "http://YOURXISERVER/" );
$time->startTime("ALL");
$sel->set_timeout_ok("120000");
if ( ! $sel->open_ok("/nagiosxi/login.php?redirect=/nagiosxi/index.php%3f&noauth=1") ) {print "Location: " . $sel->get_location() . "\n";}
elsif ( ! $sel->set_speed("1500") ) { }
elsif ( ! $sel->type_ok("usernameBox", "USERNAME") ) {print "Location: " . $sel->get_location() . "\n";}
elsif ( ! $sel->type_ok("passwordBox", "PASSWORD") ) {print "Location: " . $sel->get_location() . "\n";}
elsif ( ! $sel->click_ok("id=loginButton") ) {print "Location: " . $sel->get_location() . "\n";}
elsif ( ! $sel->wait_for_page_to_load_ok("120000") ) {}
elsif ( !$time->endTime("ALL") ) { }
else { $time->getTimes(); }
$sel->stop();