【发布时间】:2013-07-25 05:29:30
【问题描述】:
我需要在 Firefox 中禁用浏览器 cookie。
我正在使用 selenium - webdriver 2.32。
【问题讨论】:
标签: cookies selenium-webdriver
我需要在 Firefox 中禁用浏览器 cookie。
我正在使用 selenium - webdriver 2.32。
【问题讨论】:
标签: cookies selenium-webdriver
为了实现这一点,您必须首先调整配置文件首选项。执行以下操作:
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 已被禁用:
【讨论】: