使用SeleniumWebServer和ruby运行脚本时,chrome的连接被拒绝

使用SeleniumWebServer和ruby运行脚本时,chrome的连接被拒绝,ruby,selenium-webdriver,Ruby,Selenium Webdriver,我创建了一个ruby文件,其中包含一个全局变量: DRIVER=Selenium::WebDriver.for:chrome 然后我创建了全局方法: def setup @driver=DRIVER @base_url = "http://www.google.com/" @accept_next_alert = true @driver.manage.timeouts.implicit_wait = 30 @verification_errors = [] end def

我创建了一个ruby文件,其中包含一个全局变量: DRIVER=Selenium::WebDriver.for:chrome

然后我创建了全局方法:

def setup
  @driver=DRIVER
  @base_url = "http://www.google.com/"
  @accept_next_alert = true
  @driver.manage.timeouts.implicit_wait = 30
  @verification_errors = []
end

def teardown
  @driver=DRIVER
  @driver.quit
  assert_equal [], @verification_errors
end
当我尝试在脚本中使用它时,它会显示:Errno::ECONNREFUSED:Connection-rejected-connect2


上述代码适用于safari和firefox。知道为什么会显示错误吗?

我用下面的一行解决了这个问题
driver=Selenium::WebDriver.for:chrome,:switches=>%w[-ignore certificate errors]

您使用的是最新版本的Selenium WebDriver gem吗?当前版本是2.40.0。还有,Chrome的哪个版本?Chrome:version 33.0.1750.117Justin,我使用的是selenium-webdriver-2.35.1.gem,但现在我将其更新为2.40.0,但我仍然收到错误。