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

后端 未结 7 1135
[愿得一人]
[愿得一人] 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:52

    c# code

    I had the same problem and this code is working for me since 2+ months, no more crash.

     public static void WaitForModal(this IWebDriver driver)
        {
            wait.Until((d) =>
            {
                if (driver.FindElements(By.ClassName("modal-backdrop")).Count == 0)
                {
                    return driver;
                }
                return null;
            });
        }
    

    It waits until it finds no more IWebElement that have a class of "modal-backdrop".

提交回复
热议问题