Hello,
 
I encountered a difference between Watir behavior and manual clicking on
the link that is a problem for automated testing of the hole
application.
 
Here is my button/link/image, clicking on it opens a popup window:
 
<a id="ID_OPEN_POPUP1" href="#1"
onclick="javascript:setDirtyFlag();activeElementGeneralizor(this);generi
cPopupDelegator(1, 'POPUP_IDS1', 2, 'POPUP_IDS1',
'str_criteriaValuesInput1');return false;"><img id="popupImage1"
src="/c2p/images/buttons/button_arrows_round15.gif" width="15"
height="15" hspace="3" border="0" valign="absmiddle" /></a>
 
When I try to open a popup window for the first time after the page
loaded, I can do it manually, but Water does not open it, though no
error is reported by Watir itself. There is an error in Javascript on
the page that says: Member not found.
 
If I open this popup manually first time, then I can use Watir to
continue working with the page and it will open this same popup.
 
When our developers tried to debug the error, they saw, that it is
connected to using an activeElement in Javascript, they thought that,
may be, Watir does not support some of it's methods.
 
Here is the code that tested it:
 
function activeElementGeneralizor(focusedElement){//TODO release this
'hack'! //test
alert("activeElementGeneralizor("+focusedElement+")");//test 
    var message = "originally supported";
//   if(!document.activeElement){
            try{
 
alert("activeElement:"+document.activeElement.toString());
            document.activeElement=focusedElement;//TSU44 11192006: This
may be the code that Watia can not execute...
        }catch(e){
      alert("activeElement error:"+e.description);
t      alert("activeElement:"+document.activeElement.toString());
//          Document.prototype.activeElement = new HTMLElement;
//          document.activeElement = focusedElement;
        }   
    message = "modified";  
//    }
//test alert(document.activeElement+"("+message+")");
}
 
When running manually, the alert would point to url; when tested with
Watir alert was activeElement:[object] and activeElement error: Member
not found.
 
I do need to open this popup in order to run tests, so if you know, what
can be done, please, help me.
 
Thank you,
Galina Maralina.
 
 
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to