If I read the documentation for WWW::Selenium correctly, $sel->select_window() needs additional help to determine the appropriate window:
<quote>
$sel->select_window($window_id)
Selects a popup window using a window locator; once a popup window
+ has been selected, all commands go to that window. To select the mai
+n window again, use null as the target. Window locators provide diffe
+rent ways of specifying the window object:by title, by internal JavaS
+cript "name," or by JavaScript variable.
* title=My Special Window:Finds the window using the text that
+ appears in the title bar. Be careful;two windows can share the same
+title. If that happens, this locator willjust pick one.
* name=myWindow:Finds the window using its internal JavaScript
+ "name" property. This is the second parameter "windowName" passed to
+ the JavaScript method window.open(url, windowName, windowFeatures, r
+eplaceFlag)(which Selenium intercepts).
* var=variableName:Some pop-up windows are unnamed (anonymous)
+, but are associated with a JavaScript variable name in the current a
+pplication window, e.g. "window.foo = window.open(url);". In those ca
+ses, you can open the window using"var=foo".
If no window locator prefix is provided, we'll try to guess what y
+ou mean like this:
1.) if windowID is null, (or the string "null") then it is assumed
+ the user is referring to the original window instantiated by the bro
+wser).
2.) if the value of the "windowID" parameter is a JavaScript varia
+ble name in the current application window, then it is assumed that t
+his variable contains the return value from a call to the JavaScript
+window.open() method.
3.) Otherwise, selenium looks in a hash it maintains that maps str
+ing 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 necessar
+ily unique, this may have unexpected behavior.
If you're having trouble figuring out the name of a window that yo
+u want to manipulate, look at the Selenium log messages which identif
+y the names of windows created via window.open (and therefore interce
+pted by Selenium). You will see messages like the following for each
+ window as it is opened:
debug: window.open call intercepted; window ID (which you can use with
+ selectWindow()) is "myNewWindow"
</quote>
I suspect that you are falling into items 3 and 4, and the name of the window isn't really "CPAN - Google Search". (In my browser, the window is titled "CPAN - Google Search - Mozilla Firefox".)
Update -- Cleaned up the syntax in the first sentence.
----
I Go Back to Sleep, Now.
OGB
|