[prev in list] [next in list] [prev in thread] [next in thread] 

List:       selenium-devel
Subject:    [Selenium-devel] selectWindow And frames
From:       JamesWang <wangjun () neusoft ! com>
Date:       2005-10-25 11:36:07
Message-ID: 008601c5d958$4a22a0e0$3824a8c0 () jameswangneu
[Download RAW message or body]

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!

_______________________________________________
Selenium-devel mailing list
Selenium-devel@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic