该网页具有嵌套的框架结构。框架FCCBMain
嵌套在框架中Main
。我可以通过这种方式访问它:
browser.frame(:id => "FCCBMain").frames[0]
=> #<Watir::Frame:0x504e155578d49f34 located=false selector={:index=>0}>
browser.frame(:id => "FCCBMain").frames[0].id
=> "MainLeft"
但不是这样:
brwoser.frame(:id => "FCCBMain").frame(:id => "MainLeft").id
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-profile20120816-21551-1a8xyvv/extensions/fxdriver@googlecode.com/components/driver_component.js:5329:in `unknown'
from [remote server] file:///tmp/webdriver-profile20120816-21551-1a8xyvv/extensions/fxdriver@googlecode.com/components/driver_component.js:6623:in `unknown'
from [remote server] file:///tmp/webdriver-profile20120816-21551-1a8xyvv/extensions/fxdriver@googlecode.com/components/command_processor.js:9924:in `unknown'
...
我认为这两种方式非常相似。为什么后面的不起作用?
(如果有帮助,这是我正在处理的网页)