由selenium-shutterbug生成的screeenshots可以扩展名为jpg而不是png保存吗? [英] Can the screeenshots generated by selenium-shutterbug be saved with extension as jpg instead of png?
本文介绍了由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.
这篇关于由selenium-shutterbug生成的screeenshots可以扩展名为jpg而不是png保存吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文