Thanks
browser.windows(:title => "noop").should ==[] worked.
On Wed, Dec 7, 2011 at 2:14 PM, Chuck van der Linden <[email protected]>wrote:
> There's a call in watir-webdriver that returns a collection of windows
> matching a given specification, if yours is not there, it should
> return an empty array
>
> Here's code from the specs for that method. The very last of these
> sounds like it would be exactly what you are looking for.
>
> it "only returns windows matching the given selector" do
> browser.windows(:title => "closeable window").size.should == 1
> end
>
> it "raises ArgumentError if the selector is invalid" do
> lambda { browser.windows(:name => "foo") }.should
> raise_error(ArgumentError)
> end
>
> it "raises returns an empty array if no window matches the
> selector" do
> browser.windows(:title => "noop").should == []
> end
>
>
>
> On Dec 7, 12:53 pm, hillary <[email protected]> wrote:
> > Is there a webdriver equivalent to window.find in watir? I'm trying to
> > assert that a window has been closed. So for my test, it passes if it
> can't
> > find the window.
> >
> > In watir i used the following code:
> >
> > browser = Watir::Browser.attach(:url, /Account.aspx/)
> > browser.image(:id, /tabAccounts/).click
> > help = Watir::IE.find(:title, /User Guide/)
> > help.should == nil
> >
> > My best guess for webdriver is:
> > browser.window(:url, /Account.aspx/).use
> > browser.image(:id, /tabAccounts/).click
> > begin
> > browser.window(:title, /User Guide/).use
> > rescue Watir::Exception::NoMatchingWindowFoundException
> > puts "window not found"
> > end
> >
> > I'm using taza, so i'm not really sure that this code will produce a
> > failure if the window is still active.
>
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> [email protected]
> http://groups.google.com/group/watir-general
> [email protected]<http://groups.google.com/group/watir-general%[email protected]>
>
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]