由selenium-shutterbug生成的screeenshots可以扩展名为jpg而不是png保存吗?

问题描述:

Selenium-shutterbug( https://github.com/assertthat/selenium-shutterbug )将屏幕截图另存为png,是否有任何方法将其另存为jpg?

Selenium-shutterbug (https://github.com/assertthat/selenium-shutterbug) saves screenshots as png, is there any way to save them as jpg?

例如:

Shutterbug.shootPage(driver,ScrollStrategy.WHOLE_PAGE_CHROME).withName(screenshotName).save(path);

根据硒-shutterbug 变量 EXTENSION 定义为:

As per the source code of Snapshot.java for selenium-shutterbug the variable EXTENSION is defined as:

private static final String EXTENSION = "PNG";

因此,使用 selenium-shutterbug ,您无法将扩展名为 .JPG 的屏幕截图保存.它将始终以 .PNG 格式保存.

So using selenium-shutterbug you can't save the screenshot with extension as .JPG. It will be always saved in .PNG format.