cucumber - Clearing all cookies in Watir Webdriver -
in order make test run faster decided open , close browser once. clearing cookies between scenarios.
alister scott described here http://watirmelon.com/2012/04/01/five-page-object-anti-patterns/
hooks.rb:
browser = watir::browser.new :firefox before @browser = browser end at_exit browser.close end after @browser.cookies.clear end
but problem tests checking redirection anothersite.com
, @browser.cookies.clear
clearing cookies anothersite.com
. how clear all cookies without closing browser?
at time temporarily (i hope so) add
after('@sometag') @browser.goto 'mysite.com' @browser.cookies.clear end
try clearing cookies on main browser object , not copy of working with. @browser.cookies.clear
becomes browser.cookies.clear
. got feeling solve problem.
Comments
Post a Comment