pazone / ashot

WebDriver Screenshot utility. Take screenshots, crop, prettify, compare
Other
636 stars 157 forks source link

addIgnoredElement not work #132

Open GarryGaGarry opened 6 years ago

GarryGaGarry commented 6 years ago

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 commented 6 years ago
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

Kiera11 commented 5 years ago

@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?

elciak82 commented 4 years ago

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!