0

I am trying to read a test page using NHtmlUnit.WebClient. The page is keep asking to enable JavaScript. Am I missing something?

My Code:

var client = new NHtmlUnit.WebClient(BrowserVersion.FIREFOX_17); 
client.Options.JavaScriptEnabled = true;
client.WaitForBackgroundJavaScript(10000);

client.Options.ThrowExceptionOnFailingStatusCode = false;
client.AjaxController = new NicelyResynchronizingAjaxController();                                                                
var page = (HtmlPage)client.GetPage(googleCaptchaUrl);
var pageStr = page.AsXml().ToString(); 
Eyal
  • 4,653
  • 9
  • 40
  • 56
  • 3
    disabling `ThrowExceptionOnScriptError` prevents you from seeing other errors, that could be the reason – Ahmed Ashour Jul 06 '15 at 12:50
  • I removed the 'ThrowExceptionOnScriptError' - there is no errors on page. – Eyal Jul 06 '15 at 13:58
  • It would be very helpful if you could use latest HtmlUnit proper and provide your complete case, please read https://sourceforge.net/p/htmlunit/code/HEAD/tree/trunk/htmlunit/src/site/xdoc/submittingJSBugs.xml – Ahmed Ashour Jul 06 '15 at 14:50
  • I am using version 2.15.0 (got it two days ago from nuget). I changed the Browser version to: (BrowserVersion.INTERNET_EXPLORER_11) and I managed to get the page! One thing though - the process of getting the page is very very slow (15 min) – Eyal Jul 06 '15 at 15:33

0 Answers0