【发布时间】:2011-10-18 18:26:15
【问题描述】:
我正在尝试针对 Chrome 运行我的 Selenium 测试。当我在本地初始化驱动程序时:
@driver = Selenium::WebDriver.for( :chrome )
一切正常(我已经将 Chrome 二进制文件放在我的 PATH 中) 但是当我尝试远程启动它时:
@driver = Selenium::WebDriver.for(:remote, :url => 'http://' + SELENIUM_HOST + port + webdriver_hub, :desired_capabilities => :chrome)
我收到以下错误
Selenium::WebDriver::Error::UnhandledError: 的路径 chromedriver 可执行文件必须由 webdriver.chrome.driver 设置 系统属性;有关详细信息,请参阅 http://code.google.com/p/selenium/wiki/ChromeDriver。最新的 版本可以从 http://code.google.com/p/chromium/downloads/list (java.lang.IllegalStateException)
我有点困惑 - 我应该如何设置这个系统属性?我发现这段代码是用 Java 写的:
DesiredCapabilities caps = DesiredCapabilities.chrome();
caps.setJavascriptEnabled(true);
caps.setCapability("chrome.binary", "/path/to/where/chrome/is/installed/chrome.exe");
System.setProperty("webdriver.chrome.driver","/path/to/where/you/ve/put/chromedriver.exe");
ChromeDriver driver = new ChromeDriver(caps);
但我的测试是用 Ruby 编写的。 RubyBindings 不讲这个问题http://code.google.com/p/selenium/wiki/RubyBindings
【问题讨论】:
标签: ruby google-chrome selenium webdriver