I searched alot on forums to find command for capturing everything displayed on the desktop (not just the browser window), but found that this is a bug or limitation. The questions I found were of 2 to 3 years old.
So, is this still a bug or we have got some solution now?
I am using this way but it only captures the browser window.
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(scrFile, new File("c:\\Users\\rabia.asif\\Desktop\\"+time()+".png"));