I have created a Selenium Full page screenshot test for Responsive tests using selenium. But if I am going to run against the SharePoint Site then it's not taking a full-page screenshot but If I'll give any particular public site to capture the screenshots.
Here is the code snippet:
public class resTest {
@Test(groups = {"Test1"})
public void ResTest() throws InterruptedException, IOException {
System.setProperty("webdriver.gecko.driver", "C:\\browserdriver\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get(getUrl());
driver.manage().window().maximize();
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
//Enter email ID
WebElement enterEmail = wait.until(ExpectedConditions.elementToBeClickable(By.name("loginfmt")));
enterEmail.sendKeys(getUsername());
WebElement clickNext = wait.until(ExpectedConditions.elementToBeClickable(By.className("win-button")));
clickNext.click();
//Enter Password
WebElement SubmitPass = wait.until(ExpectedConditions.elementToBeClickable(By.name("passwd")));
SubmitPass.sendKeys(getPassword());
//Click on Sign In button
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@value='Sign in']")));
element.click();
WebElement afterNext = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@value='No']")));
afterNext.click();
Thread.sleep(9000);
File src = ((FirefoxDriver)driver).getFullPageScreenshotAs(OutputType.FILE);
FileHandler.copy(src, new File(System.getProperty("user.dir")+"/Res2/screen.png"));
}
}