我不知道如何在示例文本中轉換此代碼。我應該怎么寫?
wait.Until(e => e.FindElement(By.XPath("//a/h3")));
原網站:等待| 硒
原始代碼:
driver = new ChromeDriver();
driver.Url = "https://www.google.com/ncr";
driver.FindElement(By.Name("q")).SendKeys("cheese" Keys.Enter);
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
IWebElement firstResult = wait.Until(e => e.FindElement(By.XPath("//a/h3")));
Console.WriteLine(firstResult.Text);
附言。我也想知道以下內容
var foo = new WebDriverWait(driver, TimeSpan.FromSeconds(3))
.Until(drv => drv.FindElement(By.Name("q")));
.Until: ■ Function DfaultWait(Of IwebDriver).Until(Of TResult)(condition As Func(Of IWebDriver, TResult))As TResult ( 1 多載)
預先感謝
ーーーーーーーーーー
▼ 很高興地通知您,問題現已解決。
Dim firstResult As IWebElement = Wait.Untile(Function(e) e.findElement(By.XPath("//a/h3")))
感謝回復。
uj5u.com熱心網友回復:
這
wait.Until(e => e.FindElement(By.XPath("//a/h3")));
這是
wait.Until(Function(e) e.FindElement(By.XPath("//a/h3")))
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/420773.html
標籤:
上一篇:C#應用程式中沒有釋放記憶體
下一篇:WPF將按鈕與命令系結但無法觸發
