Menu

#1471 404 loading simple javascript page

Latest SVN
closed
None
1
2013-01-07
2013-01-04
luc
No

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

Discussion

  • Ahmed Ashour

    Ahmed Ashour - 2013-01-05
    • status: open --> accepted
    • assigned_to: Ahmed Ashour
     
  • Ahmed Ashour

    Ahmed Ashour - 2013-01-05

    Well, with latest SVN, I get ClassCastException: UnexpectedPage cannot be cast to JavaScriptPage

    Will fix this soon.

     
  • Ahmed Ashour

    Ahmed Ashour - 2013-01-05
    • status: accepted --> closed
     
  • Ahmed Ashour

    Ahmed Ashour - 2013-01-05

    With latest SVN, the case now works fine, the reason was "application/javascript" content type was not recognized for JavaScript pages.

     
    • luc

      luc - 2013-01-07

      Tried with 2.12-SNAPSHOT from Sonatype OSS repository, still the same problem here.

      Anything else I can do to fix this problem?

       
  • luc

    luc - 2013-01-07

    I will try again with latest svn instead of 2.11.

    Thanks!

     
  • luc

    luc - 2013-01-07

    Tried the svn but that gave:

    svn co https://htmlunit.svn.sourceforge.net/svnroot/htmlunit/trunk/htmlunit
    svn: E000002: Unable to connect to a repository at URL 'https://htmlunit.svn.sourceforge.net/svnroot/htmlunit/trunk/htmlunit'
    svn: E000002: Could not open the requested SVN filesystem
    (Probably blocked by internal firewall here...)

    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 :(

     
  • Ahmed Ashour

    Ahmed Ashour - 2013-01-07

    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

     
  • luc

    luc - 2013-01-07

    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:

    com.gargoylesoftware.htmlunit.ScriptException: Exception invoking getClientHeight
    ...
    Caused by: java.lang.ClassCastException: com.gargoylesoftware.htmlunit.javascript.host.html.HTMLFormElement cannot be cast to com.gargoylesoftware.htmlunit.javascript.host.Window

    Grmbl

     
  • Ahmed Ashour

    Ahmed Ashour - 2013-01-07

    Please open another issue, with more details (full stack trace for example)

    Please read http://htmlunit.sourceforge.net/submittingJSBugs.html

     

Log in to post a comment.