I am not quite sure what you are asking. What do you mean by "get an image on a webpage"? Do you mean:
- grab a screenshot of your page and compare it with some given value? or
- take a screenshot of specific element on webpage?
- download an image contained in (ie)
<img>
tag and do something with it?
For taking screenshots, it is widely disucessed here. Although mostly java solutions, they probably could be ported to C# with ease. If what you need is nr 3, then get the URL (ie using xpath //img[@id=\"yourId\"]@src
) and download it using something like WebClient and convert that to base64:
var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
var baseString = System.Convert.ToBase64String(plainTextBytes);