6
How to recover HTML code from a page that uses Angularjs to process some information and generate a graph?
I was able to easily recover the HTML code using Webrequest as demonstrated in the example below, but the content (graphic) generated by Angularjs does not come in the code of the page.
WebRequest request = WebRequest.Create("http://localhost:36789/minhaapp#/index");
WebResponse response = request.GetResponse();
Stream data = response.GetResponseStream();
string html = String.Empty;
using (StreamReader sr = new StreamReader(data))
{
html = sr.ReadToEnd();
}
To put it simply, the whole problem is that in your HTML code everything related to Angularjs is Javascript. When you open the page in a browser the browser itself runs all the Javascript and then generates the content of Angularjs that appears on the screen. When you via an HTTP request receive the HTML content as a string there is nothing to run Javascript and only the code is there anyway.
– SomeDeveloper
Exactly what @Leonardo said. Your angular chart is rendered after loading into the browser. You may need to use an iframe to solve this problem.
– Jhonathan
You can do this: http://toolsqa.com/selenium-c-sharp/
– Miguel