我試圖運行一個測試套件來處理jQuery的燈箱。燈箱包含一個textarea和一個提交按鈕。在燈箱出現之前,這兩個字段都是隱藏的。如何處理水豚,硒和黃瓜框架的燈箱?
但是硒並不瞭解這些元素在燈箱中的可見性。它只是顯示以下錯誤。
And I fill comment box with "Text !!" # features/step_definitions/web_steps.rb:333
Element is not currently visible and so may not be interacted with (Selenium::WebDriver::Error::ElementNotVisibleError)
[remote server] file:///tmp/webdriver-profile20120403-6182-1rd9z23/extensions/[email protected]/components/command_processor.js:9509:in `unknown'
[remote server] file:///tmp/webdriver-profile20120403-6182-1rd9z23/extensions/[email protected]/components/command_processor.js:10510:in `unknown'
[remote server] file:///tmp/webdriver-profile20120403-6182-1rd9z23/extensions/[email protected]/components/command_processor.js:10529:in `unknown'
[remote server] file:///tmp/webdriver-profile20120403-6182-1rd9z23/extensions/[email protected]/components/command_processor.js:10534:in `unknown'
[remote server] file:///tmp/webdriver-profile20120403-6182-1rd9z23/extensions/[email protected]/components/command_processor.js:10482:in `unknown'
(eval):2:in `send'
(eval):2:in `fill_in'
./features/step_definitions/web_steps.rb:335:in `/^I fill comment box with "([^"]*)"$/'
features/courses_flow.feature:21:in `And I fill comment box with "Text !!"'
某些框架實際上使_two_元素基本上相同。第一個是隱藏的,第二個是或不在。使用Firebug(和Firefinder?)來查找Selenium可以找到的所有元素。如果它在那裏,你需要改善你的搜索,或者找到所有符合要素,並過濾掉那些看不見的東西...... – 2012-04-03 06:57:25
感謝您的回覆Slanec,但我試圖找出某種方式來訪問燈箱中的元素最初在燈箱出現後隱藏並可見。 – 2012-04-03 14:33:02
這些對於WebDriver應該是可見的。你使用的是原始的Lightbox2還是一些衍生品?哪個硒版本?你能否提供一個簡單的測試用例? – 2012-04-03 15:04:06