In Java, it can be done like this:
WebDriver driver = new FirefoxDriver();
driver.get("Your-URL");
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
// Now you can do whatever you need to do with it, for example copy somewhere
FileUtils.copyFile(scrFile, new File("yourPath.png"));