Fandratt Muda
Fandratt Muda

Reputation: 140

Use Currently Saved Cookies in Watir Webdriver

Is it possible to use currently saved cookies in Watir Webdriver when launching Chrome?

I set my chrome to "remember me" when login to facebook so that the next time I access facebook, I don't have to type the username and password again. But, when using watir webdriver, the Chrome will open it like new session and accessing facebook like the first time which requires me to type the username and password again. I expected it to directly open facebook without going through the login page again. Is there a way to do that?

Thank you very much.

Upvotes: 3

Views: 405

Answers (1)

titusfortner
titusfortner

Reputation: 4194

You need to create a custom profile for Chrome, adjust its settings as desired, then direct Watir to use it by setting the Chrome switches.

args = ['--user-data-dir=/path/to/your/custom/profile']
Watir::Browser.new :chrome, options: {args: args}

Upvotes: 4

Related Questions