How can I take a remote screenshot of a website from a url?

c# html html-agility-pack multithreading webpage-screenshot


So I have an application that does:

  1. Take n amount of links from SQL

  2. Creates a new thread for each link

  3. Get HTML code of this website with HTML-Agility-Pack for each thread

  4. Saves its data to SQL (image sizes, page size, word count, words etc) and saves this process with its date

This is to check the data on a website and see if there is any changes (like a typo or a problem with images that were previously uploaded) and I want to add a screenshot/thumbnail to these for each page. How can I take a screenshot of the whole page during each thread?

10/23/2017 8:40:31 AM

Popular Answer

Seems like an interesting app. As you already get the HTML for the entire URL (I would assume the app is running on a machine/server which has internet connectivity):

There are 3 ways you can do this (many more actually).

  1. In the Thread - create a System.Windows.Forms.Form object, Add a webbrowser control to its list of Child Controls (Dock = Fill). Make the browser navigate to the url. Once navigation is complete - take the screenshot of the WinForms Dialog.
  2. In the thread - launch chrome/IE web browser passing the Url as Command line argument. Wait for sometime in the thread (there isnt a good way to know when rendering finishes). Take the screenshot.
  3. In the thread - Use selenium type of .net compatible library - which helps you do web ui testing automation and then do Step #2. You will have more granular control over the web browser using this approach.
10/23/2017 9:01:22 AM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow