ashot icon indicating copy to clipboard operation
ashot copied to clipboard

addIgnoredElement not work

Open GarryGaGarry opened this issue 6 years ago • 3 comments

Hi, I'm trying to ignore the element, but my test still falls. On test.jpg I see that the element that I'm trying to ignore is marked in red. Please help me

myScreenshot = new AShot()
            .shootingStrategy(cutting);
Screenshot screen_expanted = myScreenshot.addIgnoredElement(By.cssSelector(".screenshot-test-ignore")).takeScreenshot(wd);
ImageDiff diff = imageDiffer.makeDiff(screen_expanted, new Screenshot(ImageIO.read(new File("test.jpg"))));
ImageIO.write(diff.getMarkedImage(), "PNG", new File("diff.jpg"));
Screenshot diff_screen = new Screenshot(diff.getMarkedImage());
Screenshot actual_screen = new Screenshot(ImageIO.read(new File("test.jpg")));
assertTrue("Images should equal",
                   areImagesEqual(actual_screen, diff_screen));

GarryGaGarry avatar Sep 06 '18 14:09 GarryGaGarry

Set <Coords> coordsIgnor = myScreenshot.compileIgnoredAreas(wd, CoordsPreparationStrategy.simple());
        
Screenshot actual_screen = new Screenshot(ImageIO.read(new File("test.jpg")));
actual_screen.setIgnoredAreas(coordsIgnor);

I was helped by these lines, please make the method compileIgnorAreas public

GarryGaGarry avatar Sep 06 '18 15:09 GarryGaGarry

@GarryGaGarry Can you please explain to me how did u use it.. I am still new to selenium.. if u could please just explain to me how did you get it finally working?

Kiera11 avatar Nov 21 '18 07:11 Kiera11

Hi! @GarryGaGarry @Kiera11 I'm trying to find some information or examples of using shootingStrategy and compileIgnoredAreas. I want to ignore some elements from my screenshot (WebElements)... and I can't do it. Did you make it? Could you please explain to me how did you use it? I will be grateful!

elciak82 avatar Mar 20 '20 07:03 elciak82