NMKP
NMKP

Reputation: 799

Selenium Webdriver - disabling browser cookie

I need to disable the browser cookies in firefox.

I am using selenium - webdriver 2.32.

Upvotes: 1

Views: 2111

Answers (1)

Alpha
Alpha

Reputation: 14026

In order to achieve this, you'll have to first tweak profile preferences. Do following:

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

When you open Tools -> Options -> Privacy of the browser(which is opened by driver = Selenium::WebDriver.for :firefox, :profile => profile), you'll see picture like following which makes sure that cookie has been disabled:

cookie disabled

Upvotes: 2

Related Questions