Hi Lisa,

so it seems that you have only 1 window opened. How should the second window have been created? Through a form submit with target="_blank"? Normally htmlunit handles this correctly.

Marc.

PS: to understand Groovy's magic, Dierk (+Paul, +...)'s book is the best reference.


Lisa Crispin wrote:
Hi Marc,
Oh, that is cool, I didn't know groovy would just work by magic.

It is showing the 'newest' of my windows:

[groovy] 0-> name: , url: http://chester/reporting?reportId=10&userId=3760&in <http://chester/reporting?reportId=10&userId=3760&in>
structionId=41339

And since index="1" gets an error message, it seems not to know about any other windows. Test step selectWindow (H:\workspace\eplan70\src\web_test\SmokeTest\TestReports. xml:77: ) named "get back to main window" failed with message "Step[selectWindo w "get back to main window" (28/89)] Window not found with name: null and index:
 1 available: [TopLevelWindow[name=""]]"

Weird, huh?
thanks
Lisa

On 2/13/07, *Marc Guillemot* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Hi Lisa,

    your right, index="0" should select the oldest of your windows, what
    should be the main one.

    Can you try following
    <groovy>
    def windows = step.context.webClient.webWindows
    def index = 0
    windows.each
    {
       println index + "-> name: " + it.name <http://it.name> + ", url: " +
    it.enclosedPage.webResponse.url
    }
    </groovy>

    and look at the output on the console.

    Marc.

    Lisa Crispin wrote:
     > Hello,
     > I had some time to kill while our test database was knocked out, so I
     > went back and tried to refactor some old WebTest scripts where we
     > couldn't get things to work right before and ended up having to
    do the
     > tests in Watir.
     >
     > This particular script opens a window (I'm still having to do it with
     > invoke, I can't figure out why clickbutton on submit on the form
    brings
     > up a blank window - that's another problem, but I can't figure
    out how
     > to send in a working example of that) and then clicks a link
    within that
     > window to bring up another page within the same window.
     > <previousResponse/> of course just brings back the first page within
     > that popup window.
     >
     > I need to get back to the 'main' browser window to continue the
    test.  I
     > tried using selectWindow with the index parameter since our windows
     > don't have names.
     > <selectWindow description="get back to main window"
     >     index="0" />
     >
     > This 'passes', but I can't tell what window it thinks it's on.  It's
     > sure not on the main one. Does selectWindow have the ability to
    select
     > the 'main' window?  What index would that be?  I assumed 0, and
    if I try
     > another number it fails so apparently it thinks at this point
    there is
     > only one window to choose from.
     >
     > It's not a huge deal since we have a Watir test for these
    features, but
     > I would just like to know how to get this to work in WebTest in the
     > future.  Also, I can't believe that I'm the only person having this
     > problem.  Maybe everyone else solves it with a Groovy script.
     > thanks
     > Lisa

    _______________________________________________
    WebTest mailing list
    [email protected] <mailto:[email protected]>
    http://lists.canoo.com/mailman/listinfo/webtest




--
Lisa Crispin
Co-author,
Testing Extreme Programming
http://lisa.crispin.home.att.net <http://lisa.crispin.home.att.net>

_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to