Can anyone help me hide the 'Back to Top' button in a script that only appears after scrolling to the bottom of the page? I need to take screenshots without it showing up.
I've tried using the code below, but the 'Back to Top' button is still visible on my page.
if (driver.getPageSource().contains("scroll-to-top"))
{
WebElement element = driver.findElement(By.cssSelector("button[class*='cv-s2t']"));
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView().style.visibility='hidden'", element);
}