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:
$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'; }
But i get after this ouput in my Shell:
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.)
I have my 2 screenshots and one of them have got effectively its body in red. Somenone can help ? Many Thanks !!

In reply to Compare method with Selenium by Chaoui05

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.