Hey, guys!
I’m trying to build an app that does the following:
Executes events (such as onclick, onchange, etc) on another web application (that’s on the same server). Basically similating a live person using it. The purpose of doing this is automating testing [B]without
I have no problem executing the events, writing to text boxes, etc. The problem is caused by the app that’s being tested:
App B has multiple frames inside it. The documents in those frames call methods on “top”. However, when it’s inside of the app A’s iframe, “top” points to app A, because we’ve added an extra level of frames. So naturally, because the method app B is calling does not exist in the new “top”(app ?, there’s a javascript error like “object does not support property or method” (running it in IE 7).
My original thought was to get alll of the methods programmatically from the inner frame’s window object, create methods w/ the same name in the app A javascript that call those method back in frame.contentWindow. I tried to iterate over contents of (frame.contentWindow), via “for(var blah in window)”, but that never returns the function objects. Did research on google and it seems there is no way to get declared methods programmatically in javascript (similar to java’s object.getClass().getDeclaredMetods()? (if I’m wrong in this, please let me know).
I even made the following desperate attempt:
[code]frame.contentWindow.top = frame.contentWindow;
Didn’t work ?
Is there any way at all to catch any method call? Like this:
[code]
if something is attempting to call a method
{
if method of that name exists in the current window
{
execute window.methodName
}
else if method of that name exists in the frame.contentWindow
{
execute frame.contentWindow.methodName
}
else
throw exception
}
either something like that, or somehow getting all the method names of the document that’s inside the fame. Or changing the reference of frame’s “top” to point to the frame?
Any help would be appreciated. Thanks!