让 Selenium 和 Bootstrap 模态褪色玩的建议?
问题说明
我正在努力以 BDD 的方式生活.我正在使用 Cucumber(带有 Selenium)并且恰好在我的应用程序中使用 Twitter Bootstrap 模式.
I'm working to live life the BDD way. I'm using Cucumber (with Selenium) and happen to be using Twitter Bootstrap modals in my application.
在运行 Cucumber 测试时,我收到 "Selenium::WebDriver::Error::MoveTargetOutOfBoundsError"
错误.经过大量搜索、调试和普遍绝望后,我得出结论,这与在我的引导模式中使用 "fade"
参数有关.如果我使用 "fade"
,则会抛出错误:
While running Cucumber tests, I was getting a "Selenium::WebDriver::Error::MoveTargetOutOfBoundsError"
error. After much searching, debugging and general despair, I have concluded that it has to do with the use of the "fade"
parameter in my Bootstrap modals. If I use "fade"
, the error is thrown:
<div style="display: none;">
.
.
.
</div>
如果我去掉 "fade"
,那么 Selenium 就充满了快乐,我的测试也清晰了:
If I remove "fade"
, then Selenium is full of happiness and my tests clear:
<div style="display: none;">
.
.
.
</div>
所以,我现在正在从我的各种模式中删除 "fade"
.但是,这让我很伤心,因为我喜欢淡入淡出效果.
So, I am now removing "fade"
from my various modals. But, this makes me sad because I like the fade effect.
有没有其他人在使用 Selenium 和 Bootstrap 模式中的淡入淡出时遇到过问题?如果是这样,是否有一些巧妙的方法可以让两者很好地协同工作?
Has anyone else experienced problems using Selenium with fade in Bootstrap modals? If so, is there some clever way of getting the two to work nicely together?
顺便说一下(不确定是否重要),我是 Rails 3.2.3、Firefox 13.0.1 和 Ubuntu 12.04LTS.
By the way (not sure if it matters), I'm Rails 3.2.3, Firefox 13.0.1, and Ubuntu 12.04LTS.
正确答案
我做了一个快速测试,插入一个 WebDriverWait 来查看模态的不透明度.它似乎有效,但时间会证明(至少对我而言)这是一个间歇性问题.这是我在 Java 中的实现.
I did a quick test with inserting a WebDriverWait that takes a look at the opacity of the modal. It seems to work, but time will tell as (at least for me) it's an intermittent problem. Here's my implementation in Java.
//Ensure the modal is done animating
new WebDriverWait(driver, 5).until(
new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver webDriver) {
return webDriver.findElement(By.id("videoModal")).getCssValue("opacity").equals("1");
}
}
);
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhchabbh
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20