[wtr-general] Re: webdriver - find a window

2011-12-08 Thread Chuck van der Linden


On Dec 7, 4:41 pm, weimar weimar1...@gmail.com wrote:
 Thanks
  browser.windows(:title = noop).should ==[] worked.

but with the title of your window I presume?  (yeah maybe silly to
ask, it's the tester in me.. never assume..)

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: webdriver - find a window

2011-12-07 Thread Chuck van der Linden
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 weimar1...@gmail.com 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.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Re: webdriver - find a window

2011-12-07 Thread weimar
Thanks
 browser.windows(:title = noop).should ==[] worked.

On Wed, Dec 7, 2011 at 2:14 PM, Chuck van der Linden sqa...@gmail.comwrote:

 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 weimar1...@gmail.com 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.

 watir-general@googlegroups.com
 http://groups.google.com/group/watir-general
 watir-general+unsubscr...@googlegroups.comhttp://groups.google.com/group/watir-general%0awatir-general+unsubscr...@googlegroups.com


-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com