这不是重复的,因为提供的两个相关问题均未解决为何Web驱动程序gem无法自动更新chrome的原因,这是预期目的。提议的解决方案显示为手动修复,我正在寻找一种永久且自动的解决方案,这是webdrivers gem的目的。
在Rails应用程序上运行茶匙时出现以下错误...
$ rake teaspoon
Set localhost 3000 as the default_url_option ----
Starting the Teaspoon server...
Puma starting in single mode...
* Version 3.12.1 (ruby 2.6.3-p62), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: test
* Listening on tcp://127.0.0.1:49518
Use Ctrl-C to stop
Teaspoon running default suite at http://127.0.0.1:49518/teaspoon/default
rake aborted!
Selenium::WebDriver::Error::SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 74
(Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Mac OS X 10.13.6 x86_64)
GEM文件
group :development, :test do
# For javascript tests
gem "teaspoon-jasmine"
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
# Easy installation and use of chromedriver to run system tests with Chrome
gem 'webdrivers', '~> 4.0'
end
我认为webdrivers应该更新我的chrome驱动程序,但似乎并没有这样做。我不确定是否需要其他设置。
我的目标不是一次手动更新,而是让webdrivers gem正常运行并在运行茶匙测试时更新驱动程序。
https://github.com/jejacks0n/teaspoon#installation
https://github.com/titusfortner/webdrivers
解决方案:
我必须在测试环境中运行测试才能使其正常工作。
RAILS_ENV=test rake teaspoon