java - FirefoxDriver takes screenshots of different size -
i made java application compares screenshots taken our staging environment against production ones. app fails due different screenshot sizes.
how can define screenshot size? using following code generate screenshot.
final webdriver driver = new firefoxdriver(); try { driver.manage().window().setsize(new dimension(1024, 768)); driver.get(link); file outputfile = ((takesscreenshot) driver).getscreenshotas(outputtype.file); ....
as @würgspaß mentioned in comments, can outputtype.byte. here example:
byte[] bytes = driver.getscreenshotas(outputtype.bytes); bufferedimage full = imageio.read(new bytearrayinputstream(bytes)); full.getsubimage(0, 0, 1200, 800);
Comments
Post a Comment