• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

让 Selenium 和 Bootstrap 模态褪色玩的建议?

用户头像
it1352
帮助1

问题说明

我正在努力以 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.

正确答案

#1

我做了一个快速测试,插入一个 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
系列文章
更多 icon
同类精品
更多 icon
继续加载