【问题标题】:Connection refused for chrome when running scripts using selenium webserver and ruby使用 selenium webserver 和 ruby​​ 运行脚本时,chrome 连接被拒绝
【发布时间】:2014-10-15 02:27:00
【问题描述】:

我创建了一个具有全局变量的 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 denied - connect(2)。

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

【问题讨论】:

  • 您使用的是最新版本的selenium-webdriver gem?当前版本是2.40.0
  • 另外,Chrome 是什么版本的?
  • Chrome:版本 33.0.1750.117
  • 贾斯汀,我使用的是 selenium-webdriver-2.35.1.gem 但现在我将其更新为 2.40.0 但我仍然收到错误。

标签: ruby selenium-webdriver


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2018-07-25
    • 2012-10-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-18
    相关资源
    最近更新 更多