空白,我想使用的Watir-webdriver的一個select_list中返回文本選定值。下面就正常工作(例如,使用的Watir示例頁面http://bit.ly/watir-example)selected_options收益從IFRAME
browser = Watir::Browser.new :ie
browser.goto "http://bit.ly/watir-example"
browser.select_list(:id => "entry_6").option(:index, 2).select
puts browser.select_list(:id => "entry_6").select_list(:id => "entry_6").selected_options
=>Internet Explorer
但是,如果你堅持相同的代碼對一個框架,我得不到任何回報。
browser = Watir::Browser.new :ie
browser.goto "test_iframe.html"
browser.frame(:id => "test").select_list(:id => "entry_6").option(:index, 2).select
puts browser.frame(:id => "test").select_list(:id => "entry_6").select_list(:id => "entry_6").selected_options
=>Nothing returned
IFRAME例如:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<body>
<p>TEST IFRAME ISSUES</p>
<iframe src="http://bit.ly/watir-example" id="test" width="100%" height="1400px">
</iframe>
</body>
</html>
有我錯過了什麼或有另一種方式來實現這一目標?
此問題存在於IE中。 FF似乎工作得很好。我目前無法檢查Chrome。 – OutKa5t