在這樣的代碼:連接現有的Web瀏覽器在C#中使用Selenium自動化
using OpenQA.Selenium.Remote;
...
var driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), DesiredCapabilities.Firefox());
// To automate...
// driver.Navigate().GoToUrl("http://www.example.com/");
我得到這個錯誤:
OpenQA.Selenium.WebDriverException: 'Unexpected error. System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:4444
- 威爾這樣做代碼附加在現有的Firefox瀏覽器自動化還是什麼?
我該如何解決這個錯誤?
所以下載*硒的服務器獨立-3.4.0.jar *有必要嗎? – 5ervant
是的。你需要下載並運行jar。您還需要適合您的瀏覽器的webdriver(在相同的下載頁面上) – NattyMan0007
您的意思是,通過在http://127.0.0.1:60622/上使用Python http://stackoverflow.com/a/32882207/4883372集線器還需要你* selenium-server-standalone-3.4.0.jar *? – 5ervant