2013-07-25 105 views

回答

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 

當您打開工具 - >選項 - >瀏覽器(這是由駕駛員=硒打開:: WebDriver.for:火狐,:配置=>配置文件)的隱私,你會看到圖片像下面這確保了餅乾已被禁用:

cookie disabled

+0

這並不工作,但代碼示例有一個錯字和計算器不會讓我解決它(少於6點字符的編輯禁止的,愚蠢的規則)。將network.cookie.cookieBehvior更改爲network.cookie.cookieBehavior – nruth

+0

完成nruth。謝謝! – TDHM

相關問題