assertthat / selenium-shutterbug

Java library to create customized full page/frame/elements screenshots using Selenium WebDriver and Java AWT, screenshots and images comparison and many more cool stuff
MIT License
160 stars 46 forks source link

Doesn't make a proper whole page screenshot of the page with a modal or a popup #95

Open plagov opened 2 years ago

plagov commented 2 years ago

I used to use version 0.9.3 of the selenium-shutterbug. I did the whole page screenshot as follows:

Shutterbug.shootPage(webDriver, ScrollStrategy.WHOLE_PAGE).withName(name).save(path)

Recently, I have updated the dependency to version 1.5. The above code didn't compile, so I changed it to this:

Shutterbug.shootPage(webDriver, Capture.FULL).withName(name).save(path)

I noticed that with the updated version, it doesn't make a proper whole page screenshot if there's a modal window or a popup on the page. This modal is shown multiple times and the page looks very weird. Reverted back to 0.9.3.

glibas commented 2 years ago

Hi @plagov ,

Have you got a reproducible example so we can debug?

Thanks Glib

plagov commented 2 years ago

Hi @glibas,

It looks like this issue is partially solved. So, here's what I did. I found a public website with a React modal (at my working project the web app I'm testing is also using React). I wrote a basic test that opens a modal window and makes two screenshots - with Capture.FULL and Capture.FULL_SCROLL strategies.

So, with v1.6 of the selenium-shutterbug, the Capture.FULL strategy works fine and as expected. The other one (Capture.FULL_SCROLL) doesn't make a proper screenshot. Here's the code you can run and see how both look - https://github.com/plagov/shutterbug-screenshot-reproduce

I also checked my working project and Capture.FULL with v1.6 also does a proper screenshot with a modal. I will check throughout the week how it works with sticky headers, alert tooltips and similar floating elements.

So, it seems the Capture.FULL works fine with Chrome and Capture.FULL_SCROLL doesn't make a proper screenshot.

Let me know if you need an additional input from my side or any help!