Selenium C# WebDriver: Wait until element is present

前端 未结 24 3225
礼貌的吻别
礼貌的吻别 2020-11-22 08:53

I want to make sure that an element is present before the webdriver starts doing stuff.

I\'m trying to get something like this to work:

WebDriverWait w         


        
24条回答
  •  被撕碎了的回忆
    2020-11-22 09:52

    Alternatively you can use implicit wait:

    driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
    

    An implicit wait is to tell WebDriver to poll the DOM for a certain amount of time when trying to find an element or elements if they are not immediately available. The default setting is 0. Once set, the implicit wait is set for the life of the WebDriver object instance.

提交回复
热议问题