I am trying to make a command like $screenshot
and the bot will then send a screenshot of something on a website. I haven't found a way to actually take screenshots so I'm hoping someone here will help me out.
Asked
Active
Viewed 77 times
0

Medraj
- 173
- 2
- 6
- 17
-
Here's a related article to your question (https://stackoverflow.com/questions/4912092/using-html5-canvas-javascript-to-take-in-browser-screenshots) – Ryan Wilson Jul 27 '20 at 12:51
1 Answers
0
Can use selenium to generate a screenshot of a website.
public static void screenshot(WebDriver driver, String imageName) throws Exception{
new File(imageName).getParentFile().mkdirs();
File screenshot = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
Files.copy(screenshot, new File(imageName));
}
selenium for javascript: node selenium
can also use puppeteer

Iceberg
- 2,744
- 19
- 19
-
As the OP's tags are both `javascript` related, how is this going to help? – Ryan Wilson Jul 27 '20 at 13:06