TT#68016 selenium: simplify get_text_safe()

FirefoxExtensions.pm:
- made get_text_safe function much simpler

Change-Id: I971c2a37290723144441f5e1f10382514b850fef
(cherry picked from commit d4a98876c7)
changes/77/35377/1
Nico Schedel 6 years ago
parent f913eb1be2
commit 58deed97f8

@ -163,24 +163,12 @@ sub wait_for_attribute {
}
sub get_text_safe {
my ($self, $path, $type) = @_;
$type = "xpath" unless $type;
if($type eq "css"){
my ($self, $path) = @_;
try {
my $element = $self->find_element_by_css($path);
my $element = $self->find_element($path);
return $element->get_text();
} catch {
return 0;
return 'Element not found';
};
} elsif($type eq "xpath"){
try {
my $element = $self->find_element_by_xpath($path);
return $element->get_text();
} catch {
return 0;
};
} else {
return "Unknown Element Type: " . $type;
}
}
1;

Loading…
Cancel
Save