Chrome 分离选项不再有效 [英] Chrome detach option is no longer working

查看:35
本文介绍了Chrome 分离选项不再有效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里有一个关于 Ruby Selenium 绑定的问题

There is a question for Ruby Selenium Binding here

Ruby 中的 Selenium WebDriver:防止测试结束时关闭浏览器窗口

他试图在执行后不关闭 Chrome 的窗口,但它不起作用.我已经解决了这个问题,下面给出的程序之前可以正常工作,但现在无法正常工作

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

但我不知道如何使用这个Watir::Browser opt.任何帮助表示赞赏.

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

推荐答案

您可以使用以下格式传递 Chrome 选项:

You can pass Chrome Options using the following format:

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

这篇关于Chrome 分离选项不再有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆