Suggestions for getting Selenium to play nice with Bootstrap modal fade?

后端 未结 7 1125
[愿得一人]
[愿得一人] 2021-02-05 19:45

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.

While running Cucumber tes

7条回答
  •  后悔当初
    2021-02-05 19:50

    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() {
            @Override
            public Boolean apply(WebDriver webDriver) {         
                return webDriver.findElement(By.id("videoModal")).getCssValue("opacity").equals("1");
            }
        }
    );
    

提交回复
热议问题