//设置页面加载超时时间 this.driver.Manage().Timeouts().PageLoad.Seconds.Equals(TimeSpan.FromSeconds(300)); //隐式等待 this.driver.Manage().Timeouts().ImplicitWait.Seconds.Equals(TimeSpan.FromSeconds(300)); //异步脚本执行超时时间 this.driver.Manage().Timeouts().AsynchronousJavaScript.Hours.Equals(TimeSpan.FromHours(1)); //显示等待(推荐使用,节省时间,提高效率) WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); IWebElement element = wait.Until((d) => { try { return driver.FindElement(By.Name("word")); } catch (Exception ex) { return null; } });
标签:FromSeconds,TimeSpan,C#,selenium,driver,Equals,Timeouts,超时 From: https://www.cnblogs.com/woox/p/17921829.html