我遇到了一个奇怪的问题,selenium-webdriver不遵守gem的选定版本号,导致我的规范失败,总的来说,我似乎无法阻止它。即使在卸载gem并重新安装他们与选定的版本。我运行所有这一切的docker和它很难跟踪问题是从哪里来的。我如何获得selenium-webdriver-3.142.7作为运行验收测试的唯一选择?
- 错误:**
Failures:
1) Landing Page Navigation shows header
Failure/Error: raise e
Gem::LoadError:
can't activate selenium-webdriver (>= 4.0.0), already activated selenium-webdriver-3.142.7. Make sure all dependencies are added to Gemfile.
# /usr/local/bundle/gems/bundler-2.4.1/lib/bundler/rubygems_integration.rb:276:in `block (2 levels) in replace_gem'
# /usr/local/bundle/gems/actionpack-7.0.2.2/lib/action_dispatch/system_testing/driver.rb:24:in `initialize'
# /usr/local/bundle/gems/actionpack-7.0.2.2/lib/action_dispatch/system_test_case.rb:159:in `new'
# /usr/local/bundle/gems/actionpack-7.0.2.2/lib/action_dispatch/system_test_case.rb:159:in `driven_by'
# /usr/local/bundle/gems/rspec-rails-6.0.1/lib/rspec/rails/example/system_example_group.rb:99:in `driven_by'
# /usr/local/bundle/gems/rspec-rails-6.0.1/lib/rspec/rails/example/system_example_group.rb:94:in `block in initialize'
# /usr/local/bundle/gems/rspec-core-3.12.1/lib/rspec/core/example.rb:457:in `instance_exec'
# /usr/local/bundle/gems/rspec-core-3.12.1/lib/rspec/core/example.rb:457:in `instance_exec'
# /usr/local/bundle/gems/rspec-core-3.12.1/lib/rspec/core/hooks.rb:365:in `run'
# /usr/local/bundle/gems/rspec-core-3.12.1/lib/rspec/core/hooks.rb:529:in `block in run_owned_hooks_for'
# /usr/local/bundle/gems/rspec-core-3.12.1/lib/rspec/core/hooks.rb:528:in `each'
# /usr/local/bundle/gems/rspec-core-3.12.1/lib/rspec/core/hooks.rb:528:in `run_owned_hooks_for'
# /usr/local/bundle/gems/rspec-core-3.12.1/lib/rspec/core/hooks.rb:615:in `block in run_example_hooks_for'
# /usr/local/bundle/gems/rspec-core-3.12.1/lib/rspec/core/hooks.rb:614:in `reverse_each'
# /usr/local/bundle/gems/rspec-core-3.12.1/lib/rspec/core/hooks.rb:614:in `run_example_hooks_for'
# /usr/local/bundle/gems/rspec-core-3.12.1/lib/rspec/core/hooks.rb:484:in `run'
# /usr/local/bundle/gems/rspec-core-3.12.1/lib/rspec/core/example.rb:505:in `run_before_example'
# /usr/local/bundle/gems/rspec-core-3.12.1/lib/rspec/core/example.rb:261:in `block in run'
# /usr/local/bundle/gems/rspec-core-3.12.1/lib/rspec/core/example.rb:511:in `block in with_around_and_singleton_context_hooks'
# /usr/local/bundle/gems/rspec-core-3.12.1/lib/rspec/core/example.rb:468:in `block in with_around_example_hooks'
# /usr/local/bundle/gems/rspec-core-3.12.1/lib/rspec/core/hooks.rb:486:in `block in run'
# /usr/local/bundle/gems/rspec-core-3.12.1/lib/rspec/core/hooks.rb:626:in `block in run_around_example_hooks_for'
# /usr/local/bundle/gems/rspec-core-3.12.1/lib/rspec/core/example.rb:352:in `call'
# /usr/local/bundle/gems/rspec-rails-6.0.1/lib/rspec/rails/example/system_example_group.rb:120:in `block (2 levels) in <module:SystemExampleGroup>'
- 宝石文件**
group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri mingw x64_mingw ]
gem "rspec-rails"
gem "factory_bot_rails"
gem "faker"
end
group :development do
# Use console on exceptions pages [https://github.com/rails/web-console]
gem "web-console"
gem 'letter_opener_web', '~> 2.0'
# Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
# gem "rack-mini-profiler"
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
# gem "spring"
end
group :test do
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem "capybara"
gem 'selenium-webdriver', '~> 3.142.7'
gem "webdrivers"
end
- 停靠-编写. yml**
services:
web:
build: .
command: bash -c "rm -f tmp/pids/server.pid && bin/rails s -p 3001 -b '0.0.0.0' && rails tailwindcss:watch"
volumes:
- .:/usr/src/app
- bundle:/usr/local/bundle
ports:
- "3001:3001"
- "80:80"
env_file:
- .env
environment:
- HISTFILE=/usr/src/app/log/.bash_history
- HUB_HOST=hub:4444
depends_on:
- db
- redis
hub:
image: selenium/hub:3.8.1
environment:
GRID_BROWSER_TIMEOUT: 10000 # 10 seconds
GRID_NEW_SESSION_WAIT_TIMEOUT: 20000
GRID_NODE_POLLING: 300
GRID_TIMEOUT: 10000
ports:
- "4444:4444"
node-chrome:
image: selenium/node-chrome:3.8.1
environment: &SELENIUM_NODE_ENV
HUB_HOST: hub
HUB_PORT: 4444
ports:
- "5901:5901"
volumes:
- /dev/shm:/dev/shm
- 水豚rb**
require 'capybara'
Capybara.register_driver :chrome_headless do |app|
chrome_capabilities = ::Selenium::WebDriver::Remote::Capabilities.chrome('goog:chromeOptions' => { 'args': %w[no-sandbox headless disable-gpu window-size=1400,1400] })
if ENV['HUB_URL']
Capybara::Selenium::Driver.new(app,
browser: :remote,
url: "http://#{ENV['HUB_HOST']}/wd/hub",
capabilities: chrome_capabilities)
else
Capybara::Selenium::Driver.new(app,
browser: :chrome,
capabilities: chrome_capabilities)
end
end
1条答案
按热度按时间bis0qfac1#
没有看到你的gemfile.lock很难说。但是错误告诉你你正在尝试加载2个冲突版本的selenium-webdriver