Webdriver How to wait until the element is clickable in webdriver C#

前端 未结 4 1930
一整个雨季
一整个雨季 2020-11-29 08:56

There is a block Ui which covers all the elements for a few seconds after the Element have been generated in the browser because of this i facing a problem ,Since element ha

4条回答
  •  感情败类
    2020-11-29 09:21

    If you are having an issue such as "Another element would receive the click", a way around this is to use a while loop that waits for that overlay box to go away.

    //The below code waits 2 times in order for the problem element to go away.
    int attempts = 2;
    var elementsWeWantGone = WebDriver.FindElements(By.Id("id"));
    while (attempts > 0 && elementsWeWantGone.Count > 0)
    {
        Thread.Sleep(500);
        elementsWeWantGone = WebDriver.FindElements(By.Id("id"));
    }
    

提交回复
热议问题