远程的webdriver铬抛出"路径驱动程序的可执行文件"错误 [英] Remote Webdriver Chrome throws a "path to the driver executable" error
问题描述
喜当我使用下面的代码
IWebDriver _webDriver =新RemoteWebDriver(新的URI(HTTP://127.0。 0.1:4444 / WD /集线器)
DesiredCapabilities.Chrome());
我得到follwing错误
System.InvalidOperationException:到驱动程序可执行文件的路径必须由webdriver.chrome.driver系统属性进行设置;有关更多信息,请参见 http://code.google.com/p/selenium/wiki/ ChromeDriver 。最新的版本可以从 http://code.google.com/p/chromedriver/下载下载/列表
TearDown中:System.NullReferenceException:对象不设置到对象的实例。在OpenQA.Selenium.Remote.RemoteWebDriver.Execute在OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError
(响应errorResponse)
(字符串driverCommandToExecute,Dictionary`2参数)
在OpenQA.Selenium。 Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor,ICapabilities desiredCapabilities)
在Testframework.Browser.RemoteGoto(字符串浏览器,字符串URL)在Browser.cs:在Testframework.CommonAction.RemoteBrowser线86
(字符串浏览器)在CommonAction.cs:在RegistrationTest.cs在Test.RegistrationTest.InvalidRegistrationTest(字符串浏览器,用户名字符串,字符串密码字符串confirmPassword,字符串securityQuestion,字符串securityAnswer,字符串errorMessageText,串名字,姓氏字符串)线路70
:在Test.RegistrationTest.SnapshotOnFailure()在RegistrationTest.cs线121
:行50
$ --TearDown在Testframework.CommonAction.CaptureScreen(字符串文件名)在CommonAction.cs b $ b线590
块引用>
解决方案线索真的是在错误。
$ ; b $ b浏览器应安装在的测试无论是在运行状态还是处在指着系统上
退一步,看文档:
https://开头的代码。 google.com/p/selenium/wiki/ChromeDriver
另外,如果安装在一个奇特的地方的Chrome,你需要点硒它的位置。再次,这是在文件中说明。
在C#中:
DesiredCapabilities能力= DesiredCapabilities.Chrome() ;
capabilities.SetCapability(chrome.binary,this.binaryLocation);
或
ChromeOptions选项=新ChromeOptions();
options.BinaryLocation =pathtogooglechrome;
capabilities.SetCapability(ChromeOptions.Capability,期权);
Hi when i use the following code
IWebDriver _webDriver = new RemoteWebDriver(new Uri("http://127.0.0.1:4444/wd/hub"), DesiredCapabilities.Chrome());
I get the follwing error
System.InvalidOperationException : The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see http://code.google.com/p/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://code.google.com/p/chromedriver/downloads/list TearDown : System.NullReferenceException : Object reference not set to an instance of an object. at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) at Testframework.Browser.RemoteGoto(String browser, String url) in Browser.cs: line 86 at Testframework.CommonAction.RemoteBrowser(String browser) in CommonAction.cs: line 70 at Test.RegistrationTest.InvalidRegistrationTest(String browser, String username, String password, String confirmPassword, String securityQuestion, String securityAnswer, String errorMessageText, String firstname, String lastname) in RegistrationTest.cs: line 50 --TearDown at Testframework.CommonAction.CaptureScreen(String fileName) in CommonAction.cs: line 121 at Test.RegistrationTest.SnapshotOnFailure() in RegistrationTest.cs: line 590
解决方案The clue really is in the error.
Chrome should be installed on the system where the tests are either running on or being pointed to.
Take a step back, look at the documentation:
https://code.google.com/p/selenium/wiki/ChromeDriver
Also, if Chrome is installed in a peculiar place, you'll need to point Selenium to it's location. Again, this is explained in the documentation.
In C#:
DesiredCapabilities capabilities = DesiredCapabilities.Chrome(); capabilities.SetCapability("chrome.binary", this.binaryLocation);
or:
ChromeOptions options = new ChromeOptions(); options.BinaryLocation = "pathtogooglechrome"; capabilities.SetCapability(ChromeOptions.Capability, options);
这篇关于远程的webdriver铬抛出"路径驱动程序的可执行文件"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!