logo       

selectWindow And frames: msg#00108

web.selenium.user

Subject: selectWindow And frames

Today I tested a web app of which the first page contained three frames.
_____________
| topFrame |
|_____________|
| |
| mainFrame |
|_____________|
|bottomFrame |
|_____________|

There is a link to popup in the mainFrame and I wrote the test scripts of
below.

|open |http://192.168.36.161/envdb ||
|verifyTitle |titleOfFirstPage ||
|click |linkToOpenPopupInMainFrame ||
|pause |1000 ||
|selectWindow|nameOfPopup ||
|verifyTitle |titleOfPopup ||

Selenium 0.6 failed with "Window does not exist" and because the popup
window wasn't recorded by selenium when it was opened.
Below is the code from
"BrowserBot.prototype.modifyWindowToRecordPopUpDialogs" of
selenium-browserbo.js.

// Keep a reference to all popup windows by name
// note that in IE the "windowName" argument must be a valid javascript
identifier, it seems.
var originalOpen = windowToModify.open;
windowToModify.open = function(url, windowName, windowFeatures,
replaceFlag) {

var openedWindow = originalOpen(url, windowName, windowFeatures,
replaceFlag);
selenium.browserbot.openedWindows[windowName] = openedWindow;
return openedWindow;
};

I think the above code works only for AUT without frames.
But my link in mainFrame open window in function "window.open" of mainFrame
not "myiframe.open" so selenium couldn't find the popup.
I debugged selenium and have proved I was right.
Then I wrote the code as below just after the above code:

var windowFrames = windowToModify.frames;
if (windowFrames.length == 0)
return;

//debugger;
var frameToOverload = windowToModify.frames["mainFrame"];

var frameOriginalOpen = frameToOverload.window.open;

frameToOverload.window.open = function(url, windowName,
windowFeatures, replaceFlag) {
//debugger;

var openedWindow = frameOriginalOpen(url, windowName,
windowFeatures, replaceFlag);
selenium.browserbot.openedWindows[windowName] = openedWindow;
return openedWindow;
};

when I ran selenium ,I got "memory could not be read"error at line " var
openedWindow = frameOriginalOpen(url, windowName, windowFeatures,
replaceFlag);
"!
if I used "originalOpen" instead of "frameOriginalOpen" and got "permission
denied" error!
Please help me!I run Selenium in Win2000svr and IE6.0.

Thanks in advance and best regards!


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise