Menu

#729 Frame object still references old page

Latest SVN
closed
None
5
2014-08-17
2008-11-19
No

Hi,

here is a test case that works in IE6, but not in HtmlUnit. It actually works perfectly with a local page (saved in an html file), but not if the page is served from a Web Server. I have tried to simplify as much as possible the test case.

For test purposes, I'm hosting the test page on my Web Server. The test I'm providing will retrieve the page from there.

Test case :

public void testRemoteJS() throws Exception {

    final WebClient client = new WebClient(BrowserVersion.INTERNET_EXPLORER_6);
    HtmlPage page = (HtmlPage) client.getPage("http://htmlunit.rosechou.com/index.htm");
    page = (HtmlPage) page.getFrameByName("FR_ONGLETentree_contrat").getEnclosedPage();
    HtmlImage boutonSuivant = (HtmlImage) page.getHtmlElementById("btnS");
    client.setThrowExceptionOnScriptError(false);

    final String[] expectedAlerts = {"Données manquantes :\nle champs Domaine doit être renseigné."};
    final ArrayList<String> collectedAlerts = new ArrayList<String>();
    client.setAlertHandler(new CollectingAlertHandler(collectedAlerts));

    page = (HtmlPage) boutonSuivant.click();

    Assert.assertEquals(expectedAlerts, collectedAlerts);
}

Discussion

  • Jean-Baptiste Lemée

    Source code

     
  • Marc Guillemot

    Marc Guillemot - 2008-11-19

    I think that I've been able to isolate the root cause of the problem: the document contained in the frame is changed but in HtmlUnit the js object still refers the old Window JS object.

    I've added a test case (as NotYetImplemented): com.gargoylesoftware.htmlunit.javascript.host.HTMLFrameElementTest#changingFrameDocumentLocation

     
  • Marc Guillemot

    Marc Guillemot - 2008-11-19

    renaming to better show the cause of the problem

     
  • Jean-Baptiste Lemée

    Thanks a lot for your work !

     
  • Marc Guillemot

    Marc Guillemot - 2008-12-12

    This should now be fixed in SVN. I couldn't test with your page as it now gives a 404.

     

Log in to post a comment.