我在互聯網上嘗試了很多解決方案,但是他們中的每個人都沒有在al案件上工作,我只是想等到元素出現在網頁中, m使用硒爲c# 我嘗試過的兩件事情,他們兩個偶爾會拋出一個異常,我只是不想得到一個異常,我希望我的自動化至少等待5分鐘要加載的網頁。等待至少5分鐘元素出現
public class WaitForElement
{
public void WaitFE(string Xpath,IWebDriver webDriver)
{
WebDriverWait wait = new WebDriverWait(webDriver, TimeSpan.FromMinutes(120));
wait.Until(d => d.FindElement(By.XPath(Xpath)).Displayed);
//IWebElement category = wait.Until<IWebElement>((d) =>
//{
// return d.FindElement(By.XPath(Xpath));
//});
}
}
你是否在等待頁面加載後? – Venkatesh