原因跟解決辦法 C# selenium HTTP request to the remote web driver server for URL timed out after 60 seconds

原因跟解決辦法 C# selenium HTTP request to the remote web driver server for URL timed out after 60 seconds

C# 使用 selenium 找不到 Element 會出現 HTTP request to the remote web driver server for URL timed out after 60 seconds

原因:

使用了隱式等待 driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); 這樣語法

導致 Timeout 後 driver 無法被關閉或操作

解決辦法

""""""""""重要""""""""""

不要使用 driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); 這樣語法 (加了他catch拿不到導致GG)

就可以在 catch 拿到 NoSuchElementException

這樣會丟出 NoSuchElementException 後就可以做後續處理