Public Notes by chase_ats Tagged #preferences

Notes publicly shared by our members.
"Another thing I like to do is serialize(save) the Watir::Browser object into a file using YAML, like so: require "yaml""browserObj.yaml", 'w').write YAML::dump(@browser) This browserObj.yaml file will then contain all sorts of internal details in easily readable/parseable text, including PID of whichever browser, path to temp profile, etc. Eg. profile_dir: /tmp/webdriver-rb-profilecopy20121201-1981-9o9t9a" #Watir #browsers #cookies #preferences #states #automation #data #pub
"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/ Instead of relying on this default and randomized path, you can specify a precise location for the user data using the following flag: :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