lefthandedgoat / canopy

f# web automation and testing library, built on top of Selenium (friendly to c# also)
http://lefthandedgoat.github.io/canopy/
MIT License
506 stars 115 forks source link

save screenshot as png #470

Closed hroe closed 5 years ago

hroe commented 5 years ago

Hi, screenshots are currently saved as jpg. Is it possible to save them as png? Perhaps by adding a third parameter that gives the file format, such as png, jpg etc Thanks, Herman

lefthandedgoat commented 5 years ago

There are three ways to do this,

Via configuration/param like you suggested.

You can make your own screenshot method that behaves the way you like, using the existing code as a guide: https://github.com/lefthandedgoat/canopy/blob/master/src/canopy/canopy.parallell.functions.fs#L74

Convert all jpg to png after they are created, using this code as a guide: http://james-ramsden.com/c-convert-all-images-in-a-folder-from-png-to-jpg/

If #2 or #3 are easy enough for you, that would be my preference. If not, I can add configuration to keep things backwards compat but provide the functionality you want.

hroe commented 5 years ago

Thanks for explaining, I will try #2, Herman