ashot
ashot copied to clipboard
How to remove the scrollbar ?
When a page is captured, a scroll bar appears on the right side. How do you get rid of it?
I think you can increase the delay after every scroll to get rid of scrollbar
Can you explain it in detail?
Add this line to the import section in your class:
import org.openqa.selenium.JavascriptExecutor;
And add this line inside your method before taking the screenshot:
((JavascriptExecutor) driver).executeScript("document.body.style.overflow = 'hidden';");
It worked for me.
If solution from natalygoloborodko doesn't work try:
driver.executeScript(
"var style = document.createElement(\"style\"); style.innerHTML = \"::-webkit-scrollbar {display: none;}\"; document.body.appendChild(style);");