测试 selenium 报错

tsinghan · 2013年11月14日 · 最后由 TsingHan 回复于 2013年11月15日 · 3606 次阅读

Selenium::WebDriver::Error::WebDriverError: unable to connect to chromedriver http://127.0.0.1:9515

这个是神马原因,google 也没解决。

补充一下 默认的应该是火狐浏览器 我本地安装了火狐,但是报下面这个错误

Selenium::WebDriver::Error::WebDriverError: Could not find Firefox binary (os=macosx). Make sure Firefox is installed or set the path manually with Selenium::WebDriver::Firefox::Binary.path=

我在 google 了 在 features/support/env.rb 中 添加了

Capybara.register_driver :selenium do |app| Capybara::Selenium::Driver.new(app, :browser => :chrome) end

#1 楼 @TsingHan 格式化一下代码吧 😊

http://stackoverflow.com/questions/6821659/cucumber-selenium-webdriver-how-to-use-google-chrome-as-the-testing-browser-i

Download the Chrome driver executable and copy it in you path, e.g. /usr/bin/ and make it executable $ sudo chmod +x /usr/bin/chromedriver

#3 楼 @leozwa 照这个做了,但是还是报 题目的那个错误

莫非火狐版本太高造成的不支持?

这个我也遇到过,不过是 firefox,selenium 的版本与 浏览器的版本有关系,一般这个错试试升级浏览器,或你的 selenium 版本是否过高

需要 登录 后方可回复, 如果你还没有账号请 注册新账号