I am using Java and selenium to write some tests. I need to have my screen records while the tests are running it makes much easier for me to track if any bugs occurs. The problem is that I need to run more than one tests at the same time and as I have only one monitor I cannot record all of their screen records at the same time so I have to run the test one after each other. I was wondering if there is any way that I can run all my tests and actually minimize their browsers windows but still record what is going on at each minimized chrome window. My question may sound a bit very strange but that makes my testing very faster.
Asked
Active
Viewed 1,572 times
1 Answers
1
Yes, definitely we can take multiple screenshots. There is no affect whether the browser is in minimize or Maximize condition. Just you have to switch the new opened window & add "Take screenshot" method after each method where you have to take screenshot.
Take screenshot method can work in both mode while browser is either in Minimize or Maximize condition. For screenshot you can may use the below code:
public void getscreenshot() throws Exception
{
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
//The below method will save the screen shot in d drive with name "screenshot.png"
FileUtils.copyFile(scrFile, new File("D:\\screenshot.png"));
}
or you can opt for the multi-screen capture and the code for that is below :
public void GoogleAbout() throws Exception {
driver.get(baseUrl); // Enter the URL as per your choice
driver.findElement(By.linkText(Prop.getProperty("AboutLinkText"))).click(); //find the web element
MultiScreenShot multiScreens = new MultiScreenShot("C:\\New\\","GoogleAbout"); // Here we need to create the object which will take two arguement one is the path to save the file and second one is class name
multiScreens.multiScreenShot(driver);
driver.findElement(By.linkText("More about our philosophy")).click();
multiScreens.multiScreenShot(driver);
}
To enable the multi-screenshot you have to download the JAR file and then attached it to your project and then :
import multiScreenShot.MultiScreenShot;

Anubhav Mishra
- 106
- 2
- 17
-
so when the window is minimized, does the screenshot capture what is happening in the window? – LoveLovelyJava one May 03 '16 at 16:55
-
where can i download **MultiScreenShot** jar file from? – LoveLovelyJava one May 03 '16 at 16:59
-
oh, by the way, i am looking for screen records(video) actuality not screenshot (picturs) – LoveLovelyJava one May 03 '16 at 17:42
-
Hi, You can go to the below link to download the jar file and you can see an example too. https://github.com/Pavan-and-Vikas-Utilities/MultiScreenShot/releases – Anubhav Mishra May 04 '16 at 06:20
-
For screen recording you can follow this link of stack overflow : http://stackoverflow.com/questions/29415669/screen-recording-of-a-test-execution-in-selenium-using-java – Anubhav Mishra May 04 '16 at 06:22