簡體   English   中英

Selenium 3.8.0 wait.until調用引發異常

[英]Selenium 3.8.0 wait.until call throws exception

早上好,我有這個簡單的代碼片段:

driver.Navigate().GoToUrl("https://www.mysecretwesite.com/");
            wait = new WebDriverWait(driver, TimeSpan.FromSeconds(300));
            element = wait.Until(ExpectedConditions.ElementToBeClickable(By.PartialLinkText("partial link text")));

時間跨度很高,因為該網站需要身份驗證。 在Firefox 52和Selenium 3.0.1上運行良好,但是,在更新到Firefox 57和Selenium 3.8.1之后,wait.until調用將引發異常。 此外,將立即拋出異常,而無需等待wait變量中設置的300秒。 我找不到身份驗證表單的代碼,如下所示: 在此處輸入圖片說明 我正在使用Win 7。

Automating過程時,通過Automation Script跳過Windows Basic Authentication不是一個好習慣

在調用代碼時:

driver.Navigate().GoToUrl("https://www.mysecretwesite.com/");

在嘗試通過Windows Basic Authentication手動填充憑據時,WebDriver在到達'document.readyState' == "complete"HTML DOM尋找PartialLinkText("partial link text") 因此,如果缺少"partial link text"則會看到異常

但是,如果您看到的是英文版本的異常 ,將會使我們對處理異常的方式有更多的了解。

按照最佳實踐,我們應該嘗試僅通過WebDriver來處理Windows Basic Authentication ,如下所示:

driver.Navigate().GoToUrl("http://admin:admin@the-internet.herokuapp.com/basic_auth");

您可以在Windows Basic Authentication Selenium - Other way to basic authenticate than via url上找到一些詳細的討論Selenium - Other way to basic authenticate than via urlPython Selenium Alert — Prompt username and password is not working Selenium - Other way to basic authenticate than via url Python Selenium Alert — Prompt username and password is not working

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM