You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using aShot for visual testing. https://github.com/pazone/ashot I have some pages that I am interested in taking the screenshot only for the current visible part of the page (and not having a full page screenshot). The problem is that if I add elements to be excluded from the page, then the elements will only be excluded from a screenshot that i have scroll up to the top of the full page.
This means that if I want to exclude the same element from a screenshot that the element is visible in the viewport but I have already scroll down some pixels, then the area that is now placed is not excluded from the comparison.
I assume that the ignored areas(coords) are calculated internally from the aShot methods getting the distance from the top of the page and this works fine for full page screenshot. But when it comes to current viewport screenshot, the calculated areas refers to the same coords, so the element is not ignored.
Please let me know if there is a build in mechanism that I miss, or I have to implement the logic.
Below id my code
/** Set ignored areas **/
Set<By> allIgnoredElements = IgnoredElements.getAllIgnoredElements( getFlowType() , mapElementKey );
AShot aShot = new AShot();
for (By element : allIgnoredElements)
aShot.addIgnoredElement(element);
/** Take Screenshot **/
Screenshot actualScreenshot;
if (stickyElementsCase) {
/** Sticky elements case : loop for visible part screenshots **/
} else {
/** NO Sticky elements case : full page screenshot**/
aShot = aShot.shootingStrategy(ShootingStrategies.viewportPasting(1000));
}
actualScreenshot = aShot
.coordsProvider(new WebDriverCoordsProvider())
.takeScreenshot(getDriver());
/** Actual image **/
File actualFile = new File(
path + actualFileName
);
ImageIO.write(actualScreenshot.getImage(), "png", actualFile);
/** Expected image **/
System.out.println("expectedDir + expectedFileName = " + path + expectedFileName);
Screenshot expectedScreenshot = new Screenshot(
ImageIO.read(
new File(
path + expectedFileName
)
)
);
expectedScreenshot.setIgnoredAreas(actualScreenshot.getIgnoredAreas()); // set ignored coordinates before comparing for the master screen
expectedScreenshot.setCoordsToCompare(actualScreenshot.getCoordsToCompare()); // set coordinates which are going to be compared for the master screen
/** Final comparison **/
compareScreenshotsSoftAssert(path, mapElementKey, actualScreenshot, expectedScreenshot, screenShotIndex);
The text was updated successfully, but these errors were encountered:
I am using aShot for visual testing. https://github.com/pazone/ashot I have some pages that I am interested in taking the screenshot only for the current visible part of the page (and not having a full page screenshot). The problem is that if I add elements to be excluded from the page, then the elements will only be excluded from a screenshot that i have scroll up to the top of the full page.
This means that if I want to exclude the same element from a screenshot that the element is visible in the viewport but I have already scroll down some pixels, then the area that is now placed is not excluded from the comparison.
I assume that the ignored areas(coords) are calculated internally from the aShot methods getting the distance from the top of the page and this works fine for full page screenshot. But when it comes to current viewport screenshot, the calculated areas refers to the same coords, so the element is not ignored.
Please let me know if there is a build in mechanism that I miss, or I have to implement the logic.
Below id my code
The text was updated successfully, but these errors were encountered: