david-dick / firefox-marionette

This is a client module to automate the Mozilla Firefox browser via the Marionette protocol
https://metacpan.org/dist/Firefox-Marionette
Other
12 stars 3 forks source link

Warnings and incomplete message in StaleElement exception #3

Closed eserte closed 3 years ago

eserte commented 3 years ago

A StaleElement exception generates warnings and the error message looks incomplete. Here's a script which forces such an exception:

#!/usr/bin/env perl

use strict;
use warnings;
use Firefox::Marionette;

my $fm = Firefox::Marionette->new;
$fm->go("http://www.example.org");
my $a = $fm->find('//a');
$fm->script(q{arguments[0].parentNode.removeChild(arguments[0]);}, args => [{"element-6066-11e4-a52e-4f735466cecf" => $a->uuid}]); # hack to make $a stale
warn $a->attribute("href");

__END__

Output:

Use of uninitialized value in concatenation (.) or string at /opt/perl-5.30.3/lib/site_perl/5.30.3/Firefox/Marionette/Exception/StaleElement.pm line 15.
Use of uninitialized value in concatenation (.) or string at /opt/perl-5.30.3/lib/site_perl/5.30.3/Firefox/Marionette/Exception/StaleElement.pm line 15.
Failed to find  of " in /tmp/firefox-marionette-script-2.pl at line 11

It seems that using and value is undefined in this situation.

david-dick commented 3 years ago

Thanks. Fix committed.