Cannot Load the HTML through HtmlAgilityPack

html-agility-pack

Question

I attempt to parse HTML using HtmlAgilityPack using the straightforward doc.load function while supplying the URL, but the following result appears. How can I fix this?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script type="text/javascript">
function setCookie(c_name, value, expiredays) { 
  var exdate = new Date(); 
  exdate.setDate(exdate.getDate()+expiredays); 
  document.cookie = c_name + "=" + escape(value) + ((expiredays==null) ? "" : ";
  expires=" + exdate.toGMTString()) + ";path=/"; } 
  function getHostUri() 
  { var loc = document.location; return loc.toString(); }
  setCookie('YPF8827340282Jdskjhfiw_928937459182JAX666', '202.142.170.42', 10); 
  setCookie('DOAReferrer', document.referrer, 10); location.href = getHostUri();
</script>
</head>
<body>
<noscript>This site requires JavaScript and Cookies to be enabled. Please change your   browser settings or upgrade your browser.</noscript>
</body></html>
1
1
9/12/2013 5:59:16 AM

Popular Answer

This site requires JavaScript and Cookies to be enabled. Please change your browser settings or upgrade your browser.

The fact that Javascript must be loaded for the side and that HTMLAgilityPack is not a JavascriptEngine is clear from this message.

The Load Method of the HTML Document is just a straightforward "Download" function for static HTML sites; it cannot comprehend or run Javascript code.

You may attempt to verify which HTTP requests were made to get the material using Firebug (or some other item), and then use these requests to C# re-create to obtain the desired HTML.

These queries are similar ones:

Script Execution in HTML Agility Pack

Get the value of a JavaScript variable using C# and HTMLAgilityPack

executing javascript code from the HTML Agility Pack

0
5/23/2017 10:31:54 AM


Related Questions





Related

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