I have a simple javascript url that loads fine in a browser, but when loaded from code gives a 404:
com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 404 Not Found for http://www.crsc.philips.com/ext_elems/opinionbar/philips_p11026/overlay.js
I wrote a simple test to reproduce:
@Test
public void problemWithJsPage() throws Exception {
final WebClient webClient = new WebClient();
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
try {
final JavaScriptPage notWorkingPage = webClient .getPage("http://www.crsc.philips.com/ext_elems/opinionbar/philips_p11026/overlay.js");
} catch (FailingHttpStatusCodeException e) {
e.printStackTrace();
Assert.fail("second page failed!");
}
webClient.closeAllWindows();
}
Thanks in advance!
Luc
Well, with latest SVN, I get ClassCastException: UnexpectedPage cannot be cast to JavaScriptPage
Will fix this soon.
With latest SVN, the case now works fine, the reason was "application/javascript" content type was not recognized for JavaScript pages.
Tried with 2.12-SNAPSHOT from Sonatype OSS repository, still the same problem here.
Anything else I can do to fix this problem?
I will try again with latest svn instead of 2.11.
Thanks!
Hi, I just updated Sonatype repository (which is manually updated, http://htmlunit.sourceforge.net/gettingLatestCode.html).
You can always get latest one from SVN or from http://build.canoo.com/htmlunit/artifacts/
Please try
Tried the svn but that gave:
Did a force snapshots, tried again but same problem.
checked local repository for versions:
htmlunit-2.12-20130107.084917-2
htmlunit-core-js-2.12-20121221.093130-2
Seems the same as version on canoo.
What am I doing wrong :(
SVN has changed to:
svn co http://svn.code.sf.net/p/htmlunit/code/trunk/htmlunit/
BTW, I didn't fix 404, because i can't reproduce it.
what was fixed is ClassCastException as hinted previously.
Please try to browse the URL you mention from a web browser from the same machine you test
Found the problem. Had to do with certain proxy settings needed.
Applied the same proxy.pac as webbrowser and 404 is resolved.
Thanks very much Ahmed!
Hoped that would be the last error, but no. :(
Next page I need:
Grmbl
Please open another issue, with more details (full stack trace for example)
Please read http://htmlunit.sourceforge.net/submittingJSBugs.html