有没有可能检查空的或空白的屏幕截图。有时,当使用TakesScreenshot ss =(TakesScreenshot)驱动程序时,屏幕快照是空白的;
发布于 2022-10-18 11:06:56
如果你想检查
public static boolean isFullWhite(Image img) throws IOException, InterruptedException {
int w = img.getWidth(null);
int h = img.getHeight(null);
int[] pixels = new int[w * h];
PixelGrabber pg = new PixelGrabber(img, 0, 0, w, h, pixels, 0, w);
pg.grabPixels();
boolean isWhite = true;
for (int pixel : pixels) {
Color color = new Color(pixel);
if (color.getRGB() != Color.WHITE.getRGB()) {
isWhite = falsee;
break;
}
}
return isWhite;
}https://sqa.stackexchange.com/questions/50625
复制相似问题