- bounty将在4天后过期**。回答此问题可获得+50的声誉奖励。XmalevolentX正在寻找来自声誉良好来源的答案:寻找一个解决方案,给我的最终结果的视频中的问题。
我试图按照以下教程。
https://www.youtube.com/watch?v=cPF3GKkBHHY
我收到以下错误。sh: 1: /sbin/ip: not found
但我设法解决了这个问题,先做apt update
,然后做apt install iproute2 -y
。
我现在收到以下错误
cucumber
Feature: Search for things on Google and see results.
Scenario: See related words when searching. # features/basic.feature:3
When I search for "puppies" # features/step_defs.rb:1
Selenium::WebDriver::Remote::Driver needs :options to be set (ArgumentError)
./features/step_defs.rb:2:in `"I search for {string}"'
features/basic.feature:4:in `I search for "puppies"'
Then I should see "dog" # features/step_defs.rb:7
我想解决的错误就是这个。Selenium::WebDriver::Remote::Driver needs :options to be set (ArgumentError)
这是我的. env. rb文件。
require 'rspec' #for page.shoud etc
require 'capybara/cucumber'
require 'selenium-webdriver'
require 'pry'
#if you're accessing an internal app behind a firewall, you may not need the proxy. You can unset it like so:
#ENV['HTTP_PROXY'] = ENV['http_proxy'] = nil
#get IP of host which has 4444 mapped from other container
docker_ip = %x(/sbin/ip route|awk '/default/ { print $3 }').strip
Capybara.register_driver :remote_chrome do |app|
Capybara::Selenium::Driver.new(app,
:browser => :remote,
:desired_capabilities => :chrome,
:url => "http://#{docker_ip}:4444/wd/hub",
:options => chrome_options)
end
Capybara.configure do |config|
config.run_server = false
config.default_driver = :remote_chrome
config.app_host = 'http://www.google.com' # change this to point to your application
end
对此的任何帮助都将不胜感激。
谢谢!
2条答案
按热度按时间lf5gs5x21#
你需要创建一个
Selenium::WebDriver::Chrome::Options
的示例,并将其传递给options argument
。将这个chrome_options = Selenium::WebDriver::Chrome::Options.new
添加到你的代码中,如下所示。z6psavjg2#
解决方案:
更新env. rb文件。
之前:
之后:
更新基本功能
之前:
之后:
更新step_defs. rb
之前:
之后:
更新停靠文件
之前:
之后:
更新宝石文件
之前:
之后:
更新docker-compose. yml
之前:
之后: