use strict;
use warnings;
use Time::HiRes qw(sleep);
use Test::WWW::Selenium;
use Test::More "no_plan";
use Test::Exception;
use Text::Table;
our ($a,$critical);
print "Enter text:";
$a = <>;
print "Enter critical value:";
$critical = <>;
print $a;
print $critical;
|
|
|
|
|
$sel->click_ok("//div[\@class='x-combo-list-inner']/div[8]");
my $v7 = $sel->get_text("//div[\@class='x-combo-list-inner']/div[8]");
print($v7 . "\n");
print($critical . "\n");
if ($critical eq $v7)
{
perform operations
}
else
{
don't perform operation
}
The value of the critical which i enter from cmd i 'Last 45 Days' & the value retrieved from div[8] & stored in v7 in the above code is also same ('Last 45 Days'). But when it encounters the if loop, it doesn’t perform the operation. Is there any other ways to compare these kind of strings ?
You probably have a newline appended on $critical. Try removing it with chomp($critical);