当使用硒与水豚一起时,我希望将chrome devtools与窗户分开。
目前devtools附加在右侧(默认。)
我使用以下代码:
Capybara.register_driver :chrome do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: {
args: %w[auto-open-devtools-for-tabs], # <- this works!
prefs: {'devtools.open_docked' => false} # <- has no effect!
# also tried {devtools: {open_docked: false}}
}
)
Capybara::Selenium::Driver.new(
app, browser: :chrome, desired_capabilities: capabilities
)
end