Lines 177-187
sub click_when_visible {
Link Here
|
177 |
$self->driver->set_implicit_wait_timeout(20000); |
177 |
$self->driver->set_implicit_wait_timeout(20000); |
178 |
my ($visible, $elt); |
178 |
my ($visible, $elt); |
179 |
while ( not $visible ) { |
179 |
while ( not $visible ) { |
180 |
$elt = $self->driver->find_element($xpath_selector); |
180 |
$elt = eval {$self->driver->find_element($xpath_selector) }; |
181 |
$visible = $elt->is_displayed; |
181 |
$visible = $elt && $elt->is_displayed; |
182 |
$self->driver->pause(1000) unless $visible; |
182 |
$self->driver->pause(1000) unless $visible; |
183 |
} |
183 |
} |
184 |
$elt->click; |
184 |
|
|
|
185 |
my $clicked; |
186 |
$self->remove_error_handler; |
187 |
while ( not $clicked ) { |
188 |
eval { $elt->click }; |
189 |
$clicked = !$@; |
190 |
$self->driver->pause(1000) unless $clicked; |
191 |
} |
192 |
$self->add_error_handler; |
193 |
$elt->click unless $clicked; # finally Raise the error |
185 |
} |
194 |
} |
186 |
|
195 |
|
187 |
=head1 NAME |
196 |
=head1 NAME |
188 |
- |
|
|