selenium-shutterbug icon indicating copy to clipboard operation
selenium-shutterbug copied to clipboard

Fail to take regular element screenshot via Safari/Mac

Open MohabMohie opened this issue 3 years ago • 2 comments

When I use this line of code with safari

Shutterbug.shootElement(driver, elementLocator, CaptureElement.VIEWPORT, true);

the result is the below exception whereas I chose a VIEWPORT image that should have no scrolling

`java.lang.UnsupportedOperationException: Full scrollable element screenshot is supported in Chrome, Firefox and MicrosoftEdge browsers only.

at com.assertthat.selenium_shutterbug.utils.web.Browser.takeFullPageElementScreenshot(Browser.java:184)
at com.assertthat.selenium_shutterbug.utils.web.Browser.takeElementViewportScreenshot(Browser.java:657)
at com.assertthat.selenium_shutterbug.core.Shutterbug.shootElement(Shutterbug.java:295)`

the issue is traced to this line of code

BufferedImage image = takeFullPageElementScreenshot();

which should be changed to

BufferedImage image = takeScreenshot();

MohabMohie avatar May 09 '22 21:05 MohabMohie

@glibas any news about this issue my friend?

MohabMohie avatar Apr 10 '24 18:04 MohabMohie

Hi @MohabMohie ,

If following your suggesting of changing

BufferedImage image = takeFullPageElementScreenshot();

which should be changed to

BufferedImage image = takeScreenshot();

this will result in incorrect behaviour as takeScreenshot(); won't take the element screenshot which is passed as elementLocator.

glibas avatar Apr 10 '24 19:04 glibas