Clearing cookies using Watir WebDriver

It is very straightforward to clear the browser cookies using Watir-WebDriver:

b = Watir::Browser.new
b.goto 'www.google.com'
b.cookies.clear

I find it is often helpful to eliminate cookie state issues to clear cookies in between cucumber scenarios being run

Before do |scenario|
  browser.cookies.clear
end

See: watirwebdriver.com/clearing-cookies

Author: Alister Scott

Alister is an Excellence Wrangler for Automattic.

2 thoughts on “Clearing cookies using Watir WebDriver”

Comments are closed.