当我尝试检查一个元素是否存在于一个框架中,但实际上它没有,watir
引发一个异常。
> main_frame.exist?
=> true
> main_frame.table(:id => "Table_1").exist?
=> true
> main_frame.table(:id => "Table_2").exist?
Selenium::WebDriver::Error::StaleElementReferenceError: Element belongs to a different frame than the current one - switch to its containing frame to use it
from [remote server] resource://fxdriver/modules/web_element_cache.js:5634:in `unknown'
from [remote server] file:///tmp/webdriver-profile20120531-5558-h7vd7r/extensions/fxdriver@googlecode.com/components/driver_component.js:5329:in `unknown'
from [remote server] file:///tmp/webdriver-profile20120531-5558-h7vd7r/extensions/fxdriver@googlecode.com/components/driver_component.js:6623:in `unknown'
from [remote server] file:///tmp/webdriver-profile20120531-5558-h7vd7r/extensions/fxdriver@googlecode.com/components/command_processor.js:9924:in `unknown'
from [remote server] file:///tmp/webdriver-profile20120531-5558-h7vd7r/extensions/fxdriver@googlecode.com/components/command_processor.js:9929:in `unknown'
from [remote server] file:///tmp/webdriver-profile20120531-5558-h7vd7r/extensions/fxdriver@googlecode.com/components/command_processor.js:9875:in `unknown'
from /home/raincole/.rvm/gems/ruby-1.9.3-p125/gems/selenium-webdriver-2.22.0/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok'
from /home/raincole/.rvm/gems/ruby-1.9.3-p125/gems/selenium-webdriver-2.22.0/lib/selenium/webdriver/remote/response.rb:15:in `initialize'
from /home/raincole/.rvm/gems/ruby-1.9.3-p125/gems/selenium-webdriver-2.22.0/lib/selenium/webdriver/remote/http/common.rb:59:in `new'
...
但......不应该归还false
吗?为什么例外?