Chaoui05 has asked for the wisdom of the Perl Monks concerning the following question:
And here my output in Shell :sub Login_test : Tests { my $self = shift; foreach my $browser (@{$self->{browsers}}) { diag ("#browser $browser"); my $driver = Test::Selenium::Remote::Driver->new( browser_name => +$browser); $driver->get_ok("$url","Get url ok"); $driver->pause(2000); $driver->set_window_size(600, 600); $driver->pause(2000); my $white = Selenium::Screenshot->new( png => $driver->screenshot, exclude => [{ size => { width => 100, height => 100 }, # s +ize => $elem->get_size, location => { x => 5, y => 5 }, #location => $el +em->get_element_location, }] ); $driver->find_element('login','id')->send_keys("ok"); $driver->find_element('password','id')->send_keys("okok"); $elem = $driver->find_element('login','id'); $driver->mouse_move_to_location(element => $elem); $driver->click_ok('Click on Button submit ok'); $driver->pause(5000); $white->save( file => "snapScreenshot-$browser" ); #$driver->execute_script('document.getElementsByTagName("body")[0] +.style.backgroundColor = "red"'); my $blue = Selenium::Screenshot->new(png => $driver->screenshot); $blue->save( file => "snapScreenshot1-$browser" ); $elem = $driver->find_element('//a[@href="/logout"]'); $driver->mouse_move_to_location(element => $elem); $driver->click_ok('Logout ok'); $driver->pause(3000); $driver->quit(); } unless ($white{browser_name => $browser[0]}->compare($blue{browser_n +ame => $browser[1]})) { $diff_file = $white->difference($blue); print '#The images differ; see ' . $diff_file . ' for details'. "\ +n"; my $open_cmd; if ($^O eq 'darwin') { $open_cmd = 'open' } elsif ($^O eq 'MSWin32') { $open_cmd = ''; } else { $open_cmd = 'display'; } `$open_cmd $diff_file`; } }
What can i do ? Thanks !!Global symbol "%white" requires explicit package name at MyTest.pm lin +e 33. Global symbol "@browser" requires explicit package name at MyTest.pm l +ine 33. Global symbol "%blue" requires explicit package name at MyTest.pm line + 33. Global symbol "@browser" requires explicit package name at MyTest.pm l +ine 33. Global symbol "$diff_file" requires explicit package name at MyTest.pm + line 34. Global symbol "$blue" requires explicit package name at MyTest.pm line + 34. Global symbol "$diff_file" requires explicit package name at MyTest.pm + line 35. Global symbol "$diff_file" requires explicit package name at MyTest.pm + line 38.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Recover a variable from a loop
by hippo (Archbishop) on May 26, 2016 at 08:31 UTC | |
by Chaoui05 (Scribe) on May 26, 2016 at 09:01 UTC | |
by hippo (Archbishop) on May 26, 2016 at 09:24 UTC | |
by Chaoui05 (Scribe) on May 26, 2016 at 09:31 UTC | |
by hippo (Archbishop) on May 26, 2016 at 09:36 UTC | |
| |
by AnomalousMonk (Archbishop) on May 26, 2016 at 15:07 UTC | |
|
Re: Recover a variable from a loop
by GrandFather (Saint) on May 26, 2016 at 08:36 UTC | |
by Chaoui05 (Scribe) on May 26, 2016 at 09:08 UTC | |
|
Re: Recover a variable from a loop
by Laurent_R (Canon) on May 26, 2016 at 08:40 UTC | |
by Chaoui05 (Scribe) on May 26, 2016 at 09:28 UTC | |
by Laurent_R (Canon) on May 26, 2016 at 21:22 UTC | |
|
Re: Recover a variable from a loop
by Chaoui05 (Scribe) on May 26, 2016 at 09:39 UTC |