2016-08-10 134 views
0

我正在嘗試使用Selenium網絡驅動程序。我正在使用asp.net mvc。我已經建立了一個非常基本的測試。我基本上只是試圖打開瀏覽器。無法找到Selenium Chrome驅動程序

Imports NUnit.Framework 
Imports OpenQA.Selenium 
Imports OpenQA.Selenium.Chrome 
Imports OpenQA.Selenium.Firefox 
<TestFixture()> 
Public Class SeleniumEg 

    Dim driverFF As IWebDriver 
    Dim driverGC As IWebDriver 
    Dim driverPath As String = "c:\chromedriver.exe" 

<Test()> 
    Public Sub OpenBrowser() 
     driverGC = New ChromeDriver(driverPath) 
     driverGC.Navigate().GoToUrl("https://www.google.ie/") 
    End Sub 

End Class 

但是當我運行測試我收到此錯誤信息

結果消息:

OpenQA.Selenium.DriverServiceNotFoundException:文件C:\ chromedriver.exe \ chromedriver.exe做不存在。驅動程序可以在http://chromedriver.storage.googleapis.com/index.html

我也嘗試把驅動程序放在soloution,但我仍然得到驅動程序不存在。該錯誤消息似乎說其位置時,重複的文件名:

C:\ chromedriver.exe \ chromedriver.exe當它應該是C:\ chromedriver.exe

+0

從路徑中刪除文件名 – whymatter

回答

1

從錯誤信息,我認爲問題應該是明顯的

結果消息:OpenQA.Selenium.DriverServiceNotFoundException:文件c:\ chromedriver.exe \ chromedriver.exe不存在。駕駛者可以在http://chromedriver.storage.googleapis.com/index.html

的ChromeDriver構造函數(如果我沒有使用正確的.NET術語原諒我,我是一個Java的傢伙)預計,該chromedriver.exe二進制所在的目錄,而不是下載二進制本身的實際位置。見here

所以,請更改

Dim driverPath As String = "c:\chromedriver.exe" 

Dim driverPath As String = "c:\" 

,看看有沒有什麼幫助解決您的問題。

相關問題