簡體   English   中英

在 c# 中使用新版本的 chromedriver、chrome 和 selenium 時出現點擊問題

[英]Having issues with click when using new version of chromedriver, chrome and selenium in c#

我正在使用最新的 chrome 77.0.3865.90 我嘗試過 chromedriver 版本 - 77.0.3865.4000、76.0.3809.* 代碼在 C#

我在頁面上找到一個元素並單擊它。 這曾經可以正常工作,我認為在新的 chrome 瀏覽器更新(到 77.0.3865.90)之后,我會收到點擊錯誤:

未知錯誤:無法解析 getElementRegion 的值\n(會話信息:chrome=77.0.3865.90)“}

我嘗試使用上述多個 chromedriver 版本似乎沒有任何效果。

            WebDriverWait wait = new WebDriverWait(Driver, new TimeSpan(0, 0, 30));
        wait.Until(ExpectedConditions.ElementToBeClickable(By.Id("imgSearchReceiver"))).Click();

將 Selenium Extras 加載到您的解決方案中。

var wait = new WebDriverWait(driver, new TimeSpan(0, 0, 30));
var element = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.Id("imgSearchReceiver")));

使用Thread.sleep(4000) 有時WebDriverWait不適用於您需要等待的某些元素,睡眠是最好的解決方案。

暫無
暫無

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

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