How to wait until <div> section reload using selenium webdriver?

橙三吉。 提交于 2020-07-31 04:33:05

问题


There are multiple dropdowns in div section. If i select an option in one of the dropdown, then all the other dropdowns loads autmatically without page reload. This is because of only that particular section reloads. Sometimes this loads fast and sometimes slow. How can we set webdriver to wait until this div section reload fully.

<div id="Fruits">
...
...
</div>

Am using C# Thank you


回答1:


We can wait until div section have any sub section or child node.

WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
IWebElement myDynamicElement = wait.Until<IWebElement>((d) =>
    {
        return d.FindElement(By.XPath("//div[@id='Fruits']//*"));
    });


来源:https://stackoverflow.com/questions/63084609/how-to-wait-until-div-section-reload-using-selenium-webdriver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!