AJAX value is obtained by HTMLAgilityPack.

ajax asp.net-ajax html-agility-pack


Using the HTML Agility Pack, I'm attempting to get the value of a timer, however when I obtain the innerText by the element ID, it returns —:—:—

Given that it uses AJAX, is there a method to get the time value?

11/5/2010 3:19:16 PM

Accepted Answer

The problem is when you load anHttpAgilityPack.HtmlDocument It sends an HTTP web request to the website (of course from the web), and you get plain text in return. Neither pictures nor AJAX/JavaScript are loaded. Because it's a browser, you aren't aware of it when you see it in one. It begins loading graphics, animations, and javascript code after receiving the answer, butHtmlAgilityPack HttpWebRequest is used to get the source, and no javascript code is managed.

I advise you to download Fiddler2, which is a pretty excellent tool for inspecting HTTP traffic on your network. You may use it to establish breakpoints and examine precisely how a response is delivered, and you'll discover that the browser really does those tasks.

I'm not sure why getting the time value of a timer in AJAX is necessary, but I believe you could load the source using Internet Explorer by using the code WaTiN (while hiding it because if you don't, an IE window will appear on the screen loading the page), and when you need to get the timer's value, get the source from WaTiN and load an IE window.HtmlDocument using LoadHtml(string html) .

12/4/2010 9:06:55 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