Skip to main content

Taking screenshots

During your Automated Testing, you can take screenshots of the current webpage by issuing a "Take Screenshot" command.
Depending on which framework/language binding you are using, the syntax might be a little bit different.

If you want to automatically take a screenshot for each step in your test, you can use the custom screenshot TestingBot capability.

driver.save_screenshot("screenshot.png")
File srcFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(srcFile, new File("/location/to/screenshot.png"));
file_put_contents('screenshot.png', $web_driver->takeScreenshot());
driver.save_screenshot('screenshot.png')
const fs = require('fs');

const data = await driver.takeScreenshot();
fs.writeFileSync('screenshot.png', data, 'base64');
Screenshot screenshot = ((ITakesScreenshot)driver).GetScreenshot();
screenshot.SaveAsFile("screenshot.png");
Was this page helpful?

Looking for More Help?

Have questions or need more information?
You can reach us via the following channels: