Hello all,
 
The site I am testing with Selenium makes some heavy use of frames.  I am able 
to test it quite well using the "selectWindow" method to individually select 
the frame I want to work in.  I have a suggested patch for the file: 
"selenium-domviewer.js" so that it will walk the internal framesets.
 
This code has only been tested in Internet Explorer 6, because that's the only 
browser our application supports.  Making this change allowed us to use the dom 
viewer to see the information for all the frames in our app and made it easier 
to write test scripts for it, so I thought I'd pass it on.
 
The suggestion is to simply replace the treeTraversal method with the following 
code:
 
---------- start code --------------
function treeTraversal(root, level){
    var str = "";
    var nodes= null;
    var size = null;
    //it is supposed to show the last node, 
    //but the last node is always nodeText type
    //and we don't show it
 
  // replaced: if(!root.hasChildNodes()) {
    if(!root.hasChildNodes() && root.nodeName!="FRAME") {
        return "";//displayNode(root,level,false);
    }
 // new code section start
 if (!root.hasChildNodes() && root.nodeName=="FRAME") {
  if (root.contentDocument) {
   root = root.contentDocument;
  }
  else {
   root = root.contentWindow.document;
  }
  if (!root.hasChildNodes())
  {
   return "";
  }
 }
// new code section end

 nodes = root.childNodes;
 size = nodes.length;
    for(var i=0; i< size; i++){
        var element = nodes.item(i);
        //if the node is textNode, don't display
        if(element.nodeType==1){
            str+= displayNode(element,level,checkForChildren(element));
            str+=treeTraversal(element, level+1); 
        }
    }
    return str;
}
---------- end code --------------
 
 
  Thanks,
  Jeff Peiffer


This message is for the designated recipient only and may contain privileged, 
proprietary, or otherwise private information.  If you have received it in 
error, please notify the sender immediately and delete the original.  Any other 
use of the email by you is prohibited.
_______________________________________________
Selenium-devel mailing list
Selenium-devel@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-devel

Reply via email to