Hire QA – Specialized in QA Recruitment, Technical Interviews and Testing Solutions

How to Take Screenshot in Selenium WebDriver

Category: Selenium WebDriver
//Convert web driver object to TakeScreenshot
TakesScreenshot screenshot=((TakesScreenshot)driver);

//Call getScreenshotAs method to create image file
File SrcFile=screenshot.getScreenshotAs(OutputType.FILE);

//Copy file to Desired Location
FileUtils.copyFile(SrcFile, DestFilePath);

Leave a Reply

Your email address will not be published. Required fields are marked *