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


In reply to Re: Searching for a window using www::selenium by Old_Gray_Bear
in thread Searching for a window using www::selenium by venkatesan_G02

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.