是否可以使用现有的 chrome 用户/配置文件配置 watir webdriver
(由 chrome.exe --user-data-dir=C:\MyChromeUserProfile 创建)
在Firefox中,可以执行以下操作:(
使用firefox -P 创建了用户配置文件)profile = Selenium::WebDriver::Firefox::Profile.new(c://MyFFUserProfile)
Watir::Browser.new :ff, :profile => profile
对于Chrome,我尝试了以下代码无济于事:
Watir::Browser.new :chrome, :switches => %w['--user-data-dir=c://MyChromeUserProfile']
虽然这会打开一个 chrome 会话,但它不会使用用户的配置文件设置(特别是已安装和配置的扩展,例如用于 HTTP 基本身份验证的 Multi-pass)。
顺便说一下,这是一个类似的解决方法,但对于我正在尝试实现的 chrome,就像在http://watirwebdriver.com/basic-browser-authentication/上为 Firefox 和自动身份验证列出的一样)