Search code examples
cookiesselenium-webdriverhtmlunit-driver

Selenium HtmlUnitDriver save Session ID or Cookies


How is it possible to save the session id or the cookies I need to stay logged in at a website after the login, when I'm using HtmlUnitDriver from Selenium 2.0.


Solution

  • Enabling the cookies at first:

    webClient.getCookieManager().setCookiesEnabled(true);//enable cookies
    

    Check out the Cookies it has some more info and extra code you might want to check out