1

我需要在 Firefox 中禁用浏览器 cookie。

我正在使用 selenium - webdriver 2.32。

4

1 回答 1

2

为了实现这一点,您必须首先调整配置文件首选项。执行以下操作:

require 'selenium-webdriver'

profile = Selenium::WebDriver::Firefox::Profile.new
profile['network.cookie.cookieBehavior'] = 2 # disables all kind of cookies

driver = Selenium::WebDriver.for :firefox, :profile => profile

当您打开浏览器的工具 -> 选项 -> 隐私(由 driver = Selenium::WebDriver.for :firefox, :profile => profile 打开)时,您会看到如下图,确保 cookie 已禁用:

cookie 已禁用

于 2013-07-25T17:38:45.283 回答