简体   繁体   中英

Take screenshot of webpage along with the browser window

I am generating custom reports by implementing IReporter . I am able to take screenshot of the entire page using the following code

((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);

This captures only the HTML webpage, but I want to capture the browser window as well. Use case for this is say, suppose I check for the title of the page and assert fails. So, when I see the screenshot, I can see what the title of the page was at that time.

You can get screenshot of the full desktop using Java Robot library. See this article for implementation details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM