简体   繁体   中英

Take Screen Shot in Background using Selenium

I am Running the Script in IE browser. I have a problem, when I run the script and try to do other task on my PC the script run successfully BUT its capture the screen shots of the current window not the one in which the script is running Ie IE browser

How can I Capture the screen shot of the browser in which the script is running ? I am using following command for capturing the screen

  selenium.captureScreenshot("D:/screen_" + System.currentTimeMillis()+".jpg");      

I want to execute the script and take screen shot but at the same time I want to do my other task. After successfully execution i just want to check my screen shots.

Any Suggestion ?

Thanks Dushyant

In current user session, If you move focus on different window then It will capture current window.

Solution - Use window focus command prior to screenshot command but it might disturbing as you are working on some other windows and its moved to other window

Other solutions - As Lucas mentions - Run on different user session
Or run on different machine/VM Or keep machine ideal

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