---
title: Taking screenshots with Selenium | TestingBot Blog
description: |-
  As mentioned before on this blog, we use a homemade utility to take screenshots of browser windows.
  Our tool, built in C#, will take a screenshot o...
source_url:
  html: https://testingbot.com/blog/2011/12/24/taking-screenshots-with-selenium
  md: https://testingbot.com/blog/2011/12/24/taking-screenshots-with-selenium.md
---

# Screenshots with Selenium

By [Jochen D.](https://testingbot.com/about/jochen-d)2011-12-24

 Share on Facebook 

 Share on Twitter 

 Post on Reddit 

 Share link 

As mentioned before on this blog, we use a homemade utility to take screenshots of browser windows. Our tool, built in C#, will take a screenshot of any browser window on Windows.

We use the PrintWindow function available in Windows to take a screenshot. You can find our code on GitHub:&nbsp;[https://github.com/testingbot/Selenium-Screenshots](https://github.com/testingbot/Selenium-Screenshots)

The way it works is: we changed some Selenium code to capture the PID (Process ID) of the browser that is being used by using Java's JNA library. We pass this PID to our tool, which uses the PID to correctly identify the unique browser window. We then get its Hwnd and use PrintWindow to capture the contents of the window.

By releasing this code as open source, we thought it would possibly help others. Let us know what you think!

[← Previous post TestingBot updates](https://testingbot.com/blog/2011/12/23/testingbot-updates) [Next post → NodeJS support for Selenium testing on TestingBot](https://testingbot.com/blog/2011/12/26/nodejs-support-for-selenium-testing-on-testingbot)

## Sidebar

### TestingBot Cloud Testing

Run automated, manual and visual tests on remote browsers and devices. Sign up for a free trial.

[Free Trial](https://testingbot.com/users/sign_up)

### Latest articles

[![Announcing AI Test Insights](https://testingbot.com/assets/blog/2026/ai-insights.jpg)](https://testingbot.com/blog/ai-test-insights)

#### Announcing AI Test Insights

Use AI Insights to quickly discover why an automated test...

[Read: Announcing AI Test Insights](https://testingbot.com/blog/ai-test-insights)

[![Selenium vs Playwright 2026](https://testingbot.com/assets/blog/2026/selenium-vs-playwright-2026.jpg)](https://testingbot.com/blog/selenium-vs-playwright)

#### Selenium vs Playwright 2026

Comparing Selenium vs Playwright - which is the best test...

[Read: Selenium vs Playwright 2026](https://testingbot.com/blog/selenium-vs-playwright)

[![Maestro Physical Device Testing](https://testingbot.com/assets/blog/2026/maestro-physical.jpg)](https://testingbot.com/blog/maestro-physical-device-testing)

#### Maestro Physical Device Testing

Maestro testing in parallel on physical Android and iOS d...

[Read: Maestro Physical Device Testing](https://testingbot.com/blog/maestro-physical-device-testing)

## Related Articles

[![Selenium vs Playwright 2026](https://testingbot.com/assets/blog/2026/selenium-vs-playwright-2026.jpg)](https://testingbot.com/blog/selenium-vs-playwright "Selenium vs Playwright 2026")

### [Selenium vs Playwright 2026](https://testingbot.com/blog/selenium-vs-playwright)

Comparing Selenium vs Playwright - which is the best test framework for your usecase?

[Read article →](https://testingbot.com/blog/selenium-vs-playwright)

[![Announcing AI Test Insights](https://testingbot.com/assets/blog/2026/ai-insights.jpg)](https://testingbot.com/blog/ai-test-insights "Announcing AI Test Insights")

### [Announcing AI Test Insights](https://testingbot.com/blog/ai-test-insights)

Use AI Insights to quickly discover why an automated test failed.

[Read article →](https://testingbot.com/blog/ai-test-insights)

[![Playwright Testing on TestingBot](https://testingbot.com/assets/blog/2023/playwright-testing.jpg)](https://testingbot.com/blog/playwright-testing-introduction "Playwright Testing on TestingBot")

### [Playwright Testing on TestingBot](https://testingbot.com/blog/playwright-testing-introduction)

Learn how Playwright can run your automated tests on a variety of browsers, local or remote browsers on TestingBot.

[Read article →](https://testingbot.com/blog/playwright-testing-introduction)

[![Electron Automated Testing](https://testingbot.com/assets/blog/2024/electron.webp)](https://testingbot.com/blog/electron-automated-testing "Electron Automated Testing")

### [Electron Automated Testing](https://testingbot.com/blog/electron-automated-testing)

TestingBot now supports running automated tests against Electron-based apps on remote Windows and macOS machines in the cloud.

[Read article →](https://testingbot.com/blog/electron-automated-testing)

## More by Jochen D.

[![Announcing AI Test Insights](https://testingbot.com/assets/blog/2026/ai-insights.jpg)](https://testingbot.com/blog/ai-test-insights "Announcing AI Test Insights")
### [Announcing AI Test Insights](https://testingbot.com/blog/ai-test-insights)

Use AI Insights to quickly discover why an automated test failed.

[![Maestro Physical Device Testing](https://testingbot.com/assets/blog/2026/maestro-physical.jpg)](https://testingbot.com/blog/maestro-physical-device-testing "Maestro Physical Device Testing")
### [Maestro Physical Device Testing](https://testingbot.com/blog/maestro-physical-device-testing)

Maestro testing in parallel on physical Android and iOS devices.

[![tvOS Physical Device Testing](https://testingbot.com/assets/blog/2025/appletv.jpg)](https://testingbot.com/blog/tvos-automated-testing "tvOS Physical Device Testing")
### [tvOS Physical Device Testing](https://testingbot.com/blog/tvos-automated-testing)

Run automated tvOS tests on physical AppleTV devices.

[See all posts by Jochen D. →](https://testingbot.com/about/jochen-d)

## Ready to start testing?
[Start a free trial](https://testingbot.com/users/sign_up)
