Selenium - Wait until element is NOT visible

后端 未结 10 2073
生来不讨喜
生来不讨喜 2021-02-02 07:29

In the code below, I attempt to wait until an element is visible:

var wait = new WebDriverWait(Driver.Instance, TimeSpan.FromSeconds(10));
wait.Until(ExpectedCon         


        
10条回答
  •  隐瞒了意图╮
    2021-02-02 08:12

    The following should wait until the element is no longer displayed i.e. not visible (or time out after 10 seconds)

    var wait = new WebDriverWait(Driver.Instance, TimeSpan.FromSeconds(10));
    wait.Until(driver => !driver.FindElement(By.Id("processing")).Displayed);
    

    It will throw an exception if an element cannot be found with the id processing.

提交回复
热议问题