您好我在尝试使用selenium在vb.net中进行一些自动化测试,但在尝试使用firefox运行我的单元测试时会出现此错误。
Test Name: WebDriverSample
Test FullName: AutomationProject.UnitTests.WebDriverSample
Test Source: C:\Users\Documents\Visual Studio 2015\Projects\GasAutomationTesting\V1.0.0.0\Development\AutomationProject\UnitTests.vb : line 49
Test Outcome: Failed
Test Duration: 0:00:00.0184181
Result StackTrace:
at OpenQA.Selenium.DriverService.FindDriverServiceExecutable(String executableName, Uri downloadUrl)
at OpenQA.Selenium.Firefox.FirefoxDriverService.CreateDefaultService()
at OpenQA.Selenium.Firefox.FirefoxDriver.CreateService(FirefoxOptions options)
at OpenQA.Selenium.Firefox.FirefoxDriver..ctor(FirefoxOptions options)
at OpenQA.Selenium.Firefox.FirefoxDriver..ctor()
at AutomationProject.UnitTests.WebDriverSample() in C:\Users\Documents\Visual Studio 2015\Projects\GasAutomationTesting\V1.0.0.0\Development\AutomationProject\UnitTests.vb:line 55
Result Message:
Test method AutomationProject.UnitTests.WebDriverSample threw exception:
OpenQA.Selenium.DriverServiceNotFoundException: The geckodriver.exe file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at https://github.com/mozilla/geckodriver/releases.
这是我目前的单元测试
<TestMethod()>
Public Sub WebDriverSample()
'Add test logic here
Dim DRIVER_PATH As String = "C:\Users\Documents\Visual Studio 2015\Projects\GasAutomationTesting\GekoDriver"
Dim driver As IWebDriver
'Browser
driver = New FirefoxDriver(DRIVER_PATH)
End Sub
我试图声明gecko驱动程序的路径,但没有运气我也将.exe文件放在bin文件夹中,但我不确定该怎么做。
答案 0 :(得分:0)
你需要添加到.exe
path = C:\ Users \ Documents \ Visual Studio 2015 \ Projects \ PrepayGasAutomationTesting \ GekoDriver \ geckodriver.exe