A
A
alexzen2019-07-22 14:38:45
HTML
alexzen, 2019-07-22 14:38:45

How to take a screenshot of rendered HTML?

Good afternoon!
The task is to programmatically take and save screenshots of the rendered HTML page with CSS filter and mix-blend-mode properties on your server. At the moment I'm using PhantomJS, but it works on the old 2012 webkit and some of the properties are not supported.
Ideally, you need to learn how to take screenshots from a modern engine (webkit or gecko). What are the solutions now?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
ThunderCat, 2019-07-22
@ThunderCat

headless chrome?

B
Beetle, 2019-07-22
@Jukk

There is also Selenium WebDriver, done like this. New browsers are also supported

WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com/");
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("c:\\tmp\\screenshot.png"));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question