Question

I'm experiencing some strange behavior with Watir when I want to close the browser.

brs = Watir::Browser.new
=> #<Watir::Browser:0x1035fc1f8 url="about:blank" title="">
brs.close
=> true
brs
NoMethodError: undefined method `closed?' for nil:NilClass

The browser is closed properly (as expected) but after that I'm unable to operate with the class / instance.

Why is that happening?

Was it helpful?

Solution

I am not getting the error message:

$ irb
1.9.3-p125 :001 > require "watir-webdriver"
 => true 
1.9.3-p125 :002 > b = Watir::Browser.new
 => #<Watir::Browser:0x7e1df9f913a40838 url="about:blank" title=""> 
1.9.3-p125 :003 > b.close
 => true 
1.9.3-p125 :004 > b
 => #<Watir::Browser:0x7e1df9f913a40838 closed=true> 

Environment:

- Mac OS X 10.7.3
- Firefox 12.0

$ ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]

$ gem -v
1.8.23

$ gem list *webdriver
...
selenium-webdriver (2.21.2)
watir-webdriver (0.5.5)
...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top