你如何让 Rspec 连接到 CircleCI 上的 Chromedriver?
How can you get Rspec to connect to Chromedriver on CircleCI?
我已经在本地设置了 Chromedriver 以使用我的 Rails 堆栈并成为我的 RSpec 测试的浏览器执行器。
在本地它运行良好但在 CircleCI 上它失败并出现以下错误:
Selenium::WebDriver::Error::WebDriverError:
unable to connect to chromedriver 127.0.0.1:9515
# ./spec/spec_helper.rb:190:in `raise_with_helpfulness'
# ./spec/integration/navigate_site_pages_spec.rb:77:in `block (4 levels) in <top (required)>'
所有需要浏览器的规格都会出现这种情况。 Chromedriver 和 chrome 都使用它们自己专有的 orb 绝对安装在 circle 上,我已经通过 SSH 确认了这一点。但我仍然收到此错误。
你能试试这个吗 -
gem 卸载 chromedriver-helper
将其从 rbenv shims 中删除(对应的 chromedriver)
直接下载http://chromedriver.storage.googleapis.com/index.html
将 chromedriver 插入 $PATH 中的某处(我刚刚插入 ~/bin)
经过大量调试,最终证明这是 CircleCI 缓存的问题。我不知道为什么要缓存特定元素,但是更改缓存键可以使整个过程正常进行。
我已经在本地设置了 Chromedriver 以使用我的 Rails 堆栈并成为我的 RSpec 测试的浏览器执行器。
在本地它运行良好但在 CircleCI 上它失败并出现以下错误:
Selenium::WebDriver::Error::WebDriverError:
unable to connect to chromedriver 127.0.0.1:9515
# ./spec/spec_helper.rb:190:in `raise_with_helpfulness'
# ./spec/integration/navigate_site_pages_spec.rb:77:in `block (4 levels) in <top (required)>'
所有需要浏览器的规格都会出现这种情况。 Chromedriver 和 chrome 都使用它们自己专有的 orb 绝对安装在 circle 上,我已经通过 SSH 确认了这一点。但我仍然收到此错误。
你能试试这个吗 -
gem 卸载 chromedriver-helper
将其从 rbenv shims 中删除(对应的 chromedriver)
直接下载http://chromedriver.storage.googleapis.com/index.html
将 chromedriver 插入 $PATH 中的某处(我刚刚插入 ~/bin)
经过大量调试,最终证明这是 CircleCI 缓存的问题。我不知道为什么要缓存特定元素,但是更改缓存键可以使整个过程正常进行。