Function Do-Select-Window

Part of:

package selenium
( do-select-window < window-id > &optional (session *selenium-session*) )
Selects a popup window; once a popup window has been selected, all commands go to that window. To select the main window again, use null as the target. Note that there is a big difference between a window's internal JavaScript “name” property and the “title” of a given window's document (which is normally what you actually see, as an end user, in the title bar of the window). The “name” is normally invisible to the end-user; it's the second parameter “windowName” passed to the JavaScript method, windowName, windowFeatures, replaceFlag) (which selenium intercepts). Selenium has several strategies for finding the window object referred to by the “windowID” parameter. 1.) if windowID is null, (or the string “null”) then it is assumed the user is referring to the original window instantiated by the browser). 2.) if the value of the “windowID” parameter is a JavaScript variable name in the current application window, then it is assumed that this variable contains the return value from a call to the JavaScript method. 3.) Otherwise, selenium looks in a hash it maintains that maps string names to window “names”. 4.) If that fails, we'll try looping over all of the known windows to try to find the appropriate “title”. Since “title” is not necessarily unique, this may have unexpected behavior. If you're having trouble figuring out what is the name of a window that you want to manipulate, look at the selenium log messages which identify the names of windows created via (and therefore intercepted by selenium). You will see messages like the following for each window as it is opened: debug: call intercepted; window ID (which you can use with selectWindow()) is “myNewWindow” In some cases, Selenium will be unable to intercept a call to (if the call occurs during or before the “onLoad” event, for example). (This is bug SEL-339.) In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using an empty (blank) url, like this: openWindow(“”, “myFunnyWindow”).