需要执行以下代码集。请参考我的代码:
Capybara.register_driver :logging_selenium_chrome do |app|
caps = Selenium::WebDriver::Remote::Capabilities.chrome(loggingPrefs:
{browser: 'ALL'})
browser_options = ::Selenium::WebDriver::Chrome::Options.new()
Capybara::Selenium::Driver.new(app, browser: :chrome, options:
browser_options, desired_capabilities: caps)
end
但继续
未初始化的常量Selenium :: WebDriver :: Chrome :: Options(NameError)
任何人都知道可能导致这种情况的原因!!!
答案 0 :(得分:3)
::Selenium::WebDriver::Chrome::Options
- 升级到最新的selenium-webdriver
gem(当前为3.5.2)
答案 1 :(得分:1)
您似乎需要Capybara
声明browser_options
。见下文:
Capybara.register_driver :logging_selenium_chrome do |app|
caps = Selenium::WebDriver::Remote::Capabilities.chrome(loggingPrefs:
{browser: 'ALL'})
browser_options = Capybara::Selenium::WebDriver::Chrome::Options.new()
Capybara::Selenium::Driver.new(app, browser: :chrome, options:
browser_options, desired_capabilities: caps)
end