Selenium provides a method called getScreenshotAs() that can be used to capture a screenshot of the current browser window. We can then save the screenshot to a file or attach it to the test report.