Add/set cookie

Hi there,

I would like to ask if there is an “add” cookie solution available. If I start the webdriver again it would be awesome if the cookies of the last session would be still available (e. g. save them and use them again in another webdriver session).

Best,
Martin

Hey Martin,

currently this is not possible (at least via the Cookies node), but:

  1. It would be a nice-to-have, so we will consider to add this in a future update.
  2. You can currently use a Java Snippet node to access the Selenium cookies API directly, to set cookies. E.g.:
    webDriver.manage().addCookie(new Cookie("key", "value"));
    
  3. Another option (as you’re talking specifically about keeping a session): Persist the browser’s user profile across relaunches. See here for details.

Does any of these help?

-Philipp

4 Likes

Hello Philipp,

Thank you for your fast response and the two solutions. Yes, the first approach works for me.
The only thing is that the cookie is not implemented during the starting process of the webdriver.

Best,
Martin

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.