google chrome - How to backup browser state after Watir automation - Stack Overflow
stackoverflow.com
"I finally have a solution!
It appears that watir-webdriver stores the browser state/user data in random path. By default this can be found here (where XXXXXX is the random identifier):
/private/var/folders/2v/vkd2v3vs5njf69m59nqzc16m0000gn/T/.com.google.Chrome.XXXXXX/Default/
Instead of relying on this default and randomized path, you can specify a precise location for the user data using the following flag:
Watir::Browser.new :chrome, :switches => %w[--user-data-dir=/path/to/user/data]
Then the cache, cookies, etc. can be backed up, deleted, etc. using Ruby's standard library. Hopefully this helps someone else.
Edit: If you are unable to find where watir-webdriver is storing your user data by default, find Chrome's process id by running watir-webdriver and top. Once you have the pid, type lsof -p into terminal to find the path to the user data."
#Watir #browsers #states #preferences #cookies #automation #data #pub
Collect and share the web
Get started for free