我已经尝试了一段时间但没有运气,可以让小脚本在启动时使用永久的Chrome配置文件。
根据Chrome和Selenium文档,以下内容应该有效:
ui-view
首次启动它会初始化给定目录中的内容,但我无法停止并启动脚本,因为它将来会崩溃:
driver = Selenium::WebDriver.for(:chrome, {
detach: false,
switches: ["--user-data-dir=#{ data_dir_path }"]
})
browser = Watir::Browser.new(driver)
下一步:
/usr/local/opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/response.rb:70:in `assert_ok': unknown error: cannot parse internal JSON template: Line: 1, column: 1, Unexpected token. (Selenium::WebDriver::Error::UnknownError)
(Driver info: chromedriver=2.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1),platform=Mac OS X 10.11.6 x86_64)
from /usr/local/opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/response.rb:34:in `initialize'
from /usr/local/opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/http/common.rb:78:in `new'
from /usr/local/opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/http/common.rb:78:in `create_response'
from /usr/local/opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/http/default.rb:90:in `request'
from /usr/local/opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
from /usr/local/opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/bridge.rb:664:in `raw_execute'
from /usr/local/opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/bridge.rb:122:in `create_session'
from /usr/local/opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/bridge.rb:87:in `initialize'
from /usr/local/opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/chrome/bridge.rb:48:in `initialize'
from /usr/local/opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/common/driver.rb:60:in `new'
from /usr/local/opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/common/driver.rb:60:in `for'
from /usr/local/opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver.rb:86:in `for'
我在这里错过了什么吗?