Chrome detach option is no longer working

帅比萌擦擦* 提交于 2019-12-24 06:30:35

问题


There is a question for Ruby Selenium Binding here

Selenium WebDriver in Ruby: Preventing the test from closing the browser window at end

He was trying to not to close the window of Chrome after the execution but it's not working. I have had the solution for this problem, the given below program works fine earlier, but now it's not working

require 'watir'
caps = Selenium::WebDriver::Remote::Capabilities.chrome(chrome_options: {detach: true})
b = Watir::Browser.new :chrome, desired_capabilities: caps
b.goto('www.google.co.uk')

When I execute this program, this program is giving the warning of

2019-11-19 09:33:37 WARN Watir ["use_capabilities"] You can pass values directly into Watir::Browser opt without needing to use :desired_capabilities

But I don't know how to use this Watir::Browser opt. Any help is appreciated.


回答1:


You can pass Chrome Options using the following format:

browser = Watir::Browser.new(
  :chrome,
  'goog:chromeOptions' => {detach: true}
)


来源:https://stackoverflow.com/questions/58926616/chrome-detach-option-is-no-longer-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!