2016-12-24 254 views
-1

我無法在使用Firefox版本49.0.1的selenium網絡驅動程序中使用driver.get(「URL」)打開URL。 我得到的錯誤是:我無法在selenium網絡驅動程序中使用driver.get(「URL」)打開網址

org.openqa.selenium.firefox.NotConnectedException:無法連接後45000毫秒到主機端口7055 127.0.0.1。 Firefox的控制檯輸出

+2

添加一些更多的細節,你有沒有遇到任何錯誤? – NarendraR

+0

是的。 PFB錯誤,我越來越。 「org.openqa.selenium.firefox.NotConnectedException:無法在45000毫秒後連接到端口7055上的主機127.0.0.1。Firefox控制檯輸出」 –

+0

我認爲您使用的是舊版本的selenium jar文件,請更新到最新版本並使用'geckodriver '用firefox連接 – NarendraR

回答

1

你需要從this鏈接下載geckodriver.exe,你不能沒有壁虎駕駛員使用Firefox 49.0。下載後解壓縮並存儲在你機器上的任何位置,然後按照下面的代碼。使用Selenium版本3.0.1。 如果您使用的硒的舊版本,那麼你必須使用

WebDriver driver = new MarionetteDriver(); 

到位

WebDriver driver = new FirefoxDriver(); 

下載壁虎司機從這個鏈接:https://github.com/mozilla/geckodriver/releases

System.setProperty("webdriver.gecko.driver","C:\\Selenium\\Firefox driver\\geckodriver.exe"); // you have to select you path of gecko driver where you placed it after download and unzip. 
WebDriver driver = new FirefoxDriver(); 

driver.get("http://www.hotmail.com"); 
+0

這對我來說是一種激情。它是否適用於Mozilla的49.o的更高版本。並且我想知道爲什麼要使用geckodriver.exe(對於超過49版本的mozilla)和WebDriver driver = new MarionetteDriver();(對於較舊的硒版本)? –

相關問題