我正在嘗試將 Firefox 設定為使用 IPv6 而不是默認的 IPv4,因為與 Chrome 相比,它的運行速度非常慢。我已按照以下執行緒的說明進行操作:
Firefox Webdriver 非常慢
Selenium geckodriver 執行 findElement 比 chromedriver (.Net) 慢 10 倍
我的代碼如下所示:
FirefoxOptions firefox = new FirefoxOptions();
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService();
service.Host = "::1";
firefox.AddArgument("-headless");
return new FirefoxDriver(service, firefox);
我也試過像這樣傳入 geckodriver 位置:
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(LocalConfig.Root "bin\\Debug", "geckodriver.exe");
我得到的錯誤如下:
OpenQA.Selenium.WebDriverException:無法在 http://localhost:50171/ 上啟動驅動程式服務
如果我將 service.Host 設定為空字串,則測驗將運行而不會出現任何錯誤。
如果我向它傳遞一堆隨機字符,它會產生與上面相同的錯誤,讓我懷疑它是否甚至識別 ::1 字串。
我在這里遺漏了一些明顯的東西嗎?謝謝
uj5u.com熱心網友回復:
原來是一個新的bug。如果其他人遇到同樣的問題,正在以下地方查看它:
https://bugzilla.mozilla.org/show_bug.cgi?id=1732622
https://github.com/mozilla/geckodriver/issues/1936
https://github.com/mozilla/geckodriver/issues/1935
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/346994.html
