Menu

IFrame questions

Help
2003-12-09
2004-02-04
  • Scott Lillibridge

    I have code to navigate an IFrame. Everything works great until I try to get the frame from the WebResponse.
    This code:

            String[] frames = response.getFrameNames();
            for(int i=0; i<frames.length; i++){
                System.out.println(i +") "+frames[i]);
            }

    produces the expected output of
    0) dyn

    but the following code:

            WebResponse dynFrame = response.getSubframeContents("dyn");

    produces the following exception
    com.meterware.httpunit.NoSuchFrameException: No frame named dyn is currently active

        at com.meterware.httpunit.WebWindow.getFrameContents(WebWindow.java:203)

        at com.meterware.httpunit.WebResponse.getSubframeContents(WebResponse.java:274)
    ...snip...

    I just wonder if I am doing this correctly. Is this the appropriate way to get an iframe, or is there a better way?

     
    • Wolfgang Jung

      Wolfgang Jung - 2003-12-18

      I have the same problem with dynamic created framesets via JavaScript document.write().

      The following code gives the same exception:
      ...snip...
          WebResponse top = wc.getFrameContents("_top");
         
          log.debug("Frames = " + Arrays.asList(top.getFrameNames()));
          // getFrameNames gives me [content, help, menu]
          top.getSubframeContents("content");
          // No I got the exception, that content is not active
      ...snip...

       
    • Anonymous

      Anonymous - 2004-02-04

      I'm sorry to post a me too.

      [04 Feb 2004 16:59:37,DEBUG,ClickLinkAction] requestTarget: content:documentBrowser:documentList
      [04 Feb 2004 16:59:37,DEBUG,ClickLinkAction] frameName[: 0]: reminder
      [04 Feb 2004 16:59:37,DEBUG,ClickLinkAction] frameName[: 1]: content:documentBrowser:documentDirectory
      [04 Feb 2004 16:59:37,DEBUG,ClickLinkAction] frameName[: 2]: content:documentBrowser
      [04 Feb 2004 16:59:37,DEBUG,ClickLinkAction] frameName[: 3]: content
      [04 Feb 2004 16:59:37,DEBUG,ClickLinkAction] frameName[: 4]: menu
      [04 Feb 2004 16:59:37,DEBUG,ClickLinkAction] frameName[: 5]: _top
      [04 Feb 2004 16:59:37,DEBUG,ClickLinkAction] frameName[: 6]: content:documentBrowser:documentList
      [04 Feb 2004 16:59:39,DEBUG,ClickLinkAction] No frame named content:documentBrowser:documentList is currently active
      com.meterware.httpunit.NoSuchFrameException: No frame named content:documentBrowser:documentList is currently active
              at com.meterware.httpunit.WebWindow.getFrameContents(WebWindow.java:203)
              at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:120)
              at com.meterware.httpunit.WebWindow.updateWindow(WebWindow.java:141)
              at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:127)
              at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:118)
              at com.meterware.httpunit.WebClient.getResponse(WebClient.java:112)
              at yatsy.logic.html.HTTPClient.loadPage(HTTPClient.java:441)
              at yatsy.logic.actions.base.ClickLinkAction.perform(ClickLinkAction.java:176)
              at yatsy.logic.actions.lang.SERIALAction.perform(SERIALAction.java:75)

      I have a link in an iframe nested in another iframe in a frame
      contained by the main document. The hierarchy is
      content:documentBrowser:documentList. This link is used to load the
      page pointed to by the link target.

      yatsy.logic.html.HTTPClient.loadPage() only does a
      WebConversation.getResponse( WebRequest request ).

      As can be seen above, the frame names in the current document contain
      the requested target.

      So why do i get a NoSuchFrameException?

       

Log in to post a comment.