Chaoui05 has asked for the wisdom of the Perl Monks concerning the following question:
Hi every Monks ! I am appealing to your wisdom yet again. I have an issue. Iam using Selenium::Screenshot. I get screenshots i'd like to compare. I did this following code:
But i get after this ouput in my Shell:$driver->set_window_size(320, 480); $elem = $driver->find_element('applgs','id' ); my $white = Selenium::Screenshot->new( png => $driver->screenshot, exclude => [{ size => { width => 10, height => 10 }, location => { x => 5, y => 5 }, }] )->save( file => "snapScreenshot" ); $driver->execute_script('document.getElementsByTagName("body")[0]. +style.backgroundColor = "red"'); my $blue = Selenium::Screenshot->new(png => $driver->screenshot)-> +save( file => "snapScreenshot1" ); unless ($white->compare($blue)) { my $diff_file = $white->difference($blue); print 'The images differ; see ' . $diff_file . ' for details'; }
I have my 2 screenshots and one of them have got effectively its body in red. Somenone can help ? Many Thanks !!not ok 22 - A_test died (Can't locate object method "compare" via pack +age "D:/t/gui-tests/tests/screenshots/snapScreenshot-firefox.png " (perhaps you forgot to load "D:/t/gui-tests/tests/screenshots/snapSc +reenshot-firefox.png"?) at MyTestingSuite.pm line 260.)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Compare method with Selenium
by choroba (Cardinal) on May 25, 2016 at 07:45 UTC | |
by Chaoui05 (Scribe) on May 25, 2016 at 08:16 UTC | |
Re: Compare method with Selenium
by ablanke (Monsignor) on May 25, 2016 at 08:16 UTC | |
by Chaoui05 (Scribe) on May 25, 2016 at 08:31 UTC |
Back to
Seekers of Perl Wisdom