建议让Selenium与Bootstrap模态淡入淡出玩得好吗?

jvi*_*ian 13 selenium cucumber ruby-on-rails-3 twitter-bootstrap

我正在努力以生活方式生活BDD.我正在使用Cucumber(使用Selenium)并且碰巧在我的应用程序中使用Twitter Bootstrap模式.

在运行Cucumber测试时,我遇到了"Selenium::WebDriver::Error::MoveTargetOutOfBoundsError"错误.一番搜索,调试和一般的绝望后,我的结论是,它具有与使用的做"fade"在我的引导模态参数.如果我使用"fade",则抛出错误:

<div class="modal hide fade" id="info-share-edit-modal" style="display: none;">
  .
  .
  .
</div>
Run Code Online (Sandbox Code Playgroud)

如果我删除"fade",那么Selenium充满了快乐,我的测试清晰:

<div class="modal hide" id="info-share-edit-modal" style="display: none;">
  .
  .
  .
</div>
Run Code Online (Sandbox Code Playgroud)

所以,我现在正"fade"从我的各种模态中删除.但是,这让我感到难过,因为我喜欢淡化效果.

有没有其他人使用Selenium在Bootstrap模式中淡入淡出?如果是这样,是否有一些聪明的方法可以使两者很好地协同工作?

顺便说一句(不确定是否重要),我是Rails 3.2.3,Firefox 13.0.1和Ubuntu 12.04LTS.

use*_*252 8

我做了一个快速测试,插入一个WebDriverWait,看看模态的不透明度.它似乎有效,但时间会告诉我(至少对我来说)这是一个间歇性的问题.这是我在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");
        }
    }
);
Run Code Online (Sandbox Code Playgroud)


nic*_*des 0

放入一个标志,以便在测试环境中它不会褪色,但在其他所有环境中都会褪色。