1from selenium import webdriver
2from time import sleep
3
4driver = webdriver.Firefox()
5driver.get('https://www.python.org')
6sleep(1)
7
8driver.get_screenshot_as_file("screenshot.png")
9driver.quit()
10print("end...")
1Java
2Yes, it is possible. The following example is in Java:
3
4WebDriver driver = new FirefoxDriver();
5driver.get("http://www.google.com/");
6File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
7// Now you can do whatever you need to do with it, for example copy somewhere
8FileUtils.copyFile(scrFile, new File("c:\\tmp\\screenshot.png"));