我正在使用colorbox库在我的应用程序(http://colorpowered.com/colorbox/)中显示lightbox。该代码似乎在浏览器中正常工作,但我无法使自动化测试正常工作。如何让硒/黄瓜与现在在Lightbox/colorbox中的“隐藏”链接交互?
这里是获取生成一些内嵌HTML:
<div class='hidden'>
<div id='override'>
Are you sure you want to override this action?
<br>
<a href="" class="close_colorbox">Cancel</a></li>
<a href="#" onclick="override(this); return false;">Override once</a>
</div>
</div>
这是打开的颜色框的JavaScript:
$.fn.colorbox({innerWidth:600, inline:true, href:'#override', scrolling:false});
该代码打开收藏和展示我的“#override的内容'div。在我黄瓜测试中,我可以从该分区中查找文本,但如果我试图遵循链接我得到一个错误:
When I follow "link that generates override"
Then I should see "Are you sure you want to override this action?" within "#cboxContent"
Then I should see "Cancel" within "#cboxContent"
# Then show me the page
When I follow "Cancel" within "#cboxContent"
给出了这样的错误:
Element is not currently visible and so may not be interacted with (Selenium::WebDriver::Error::ElementNotDisplayedError)
[remote server] resource://fxdriver/modules/atoms.js:7903:in `'
[remote server] file:///var/folders/nn/nn5oYAICGPawlH+1W406+k+++TI/-Tmp-/webdriver-profile20110524-2973-1d5qq7w/extensions/[email protected]/components/nsCommandProcessor.js:249:in `'
[remote server] file:///var/folders/nn/nn5oYAICGPawlH+1W406+k+++TI/-Tmp-/webdriver-profile20110524-2973-1d5qq7w/extensions/[email protected]/components/nsCommandProcessor.js:298:in `'
[remote server] file:///var/folders/nn/nn5oYAICGPawlH+1W406+k+++TI/-Tmp-/webdriver-profile20110524-2973-1d5qq7w/extensions/[email protected]/components/nsCommandProcessor.js:313:in `'
[remote server] file:///var/folders/nn/nn5oYAICGPawlH+1W406+k+++TI/-Tmp-/webdriver-profile20110524-2973-1d5qq7w/extensions/[email protected]/components/nsCommandProcessor.js:190:in `'
./features/step_definitions/web_steps.rb:35
./features/step_definitions/web_steps.rb:14:in `with_scope'
./features/step_definitions/web_steps.rb:14:in `with_scope'
./features/step_definitions/web_steps.rb:34:in `/^(?:|I)follow "([^"]*)"(?: within "([^"]*)")?$/'
features/prerequisites.feature:38:in `When I follow "Cancel" within "#cboxContent"'
有没有人见过这个错误你是如何解决它的? (如果我取消注释'显示我的网页'的步骤,那么它也可以)
看起来好像$ .fn.colorbox调用没有完成时,我试图按照取消链接(所以它仍然隐藏在其他股利)。我试图找出使水豚/硒等待div变得可见的最佳方式。 – nimblegorilla 2011-05-24 18:32:11