Skip to content
Easily share Selenium WebDriver cookies with Rest Assured back and forth with this Java library
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Updated dependencies to latest Nov 7, 2018
.gitignore
LICENSE
README.md
pom.xml

README.md

selenium-to-restassured

Easily share Selenium WebDriver cookies with Rest Assured back and forth with this Java api.

Installation

Download the latest jar and add to your project. You can then add it to your maven project by adding the following dependency:

<dependency>
    <groupId>uk.co.mwtestconsultancy</groupId>
    <artifactId>selenium-to-restassured</artifactId>
    <version>0.3</version>
</dependency>

Usage

You have two options you can either convert from RestAssured to Selenium:

io.restassured.http.Cookie cookieToConvert = response.getDetailedCookie("COOKIE NAME")

CookieAdapter cookieAdapter = new CookieAdapter();
org.openqa.selenium.Cookie convertedCookie = cookieAdapter.convertToSelenium(cookieToConvert);

Or you can convert from Selenium to RestAssured

org.openqa.selenium.Cookie cookieToConvert = driver.manage().getCookieNamed("COOKIE NAME");

CookieAdapter cookieAdapter = new CookieAdapter();
io.restassured.http.Cookie adaptedCookie = cookieAdapter.convertToRestAssured(seleniumCookie);

Additionally CookieAdapter will take an enum to convert Selenium expiry dates into either:

Expiry Dates

CookieAdapter cookieAdapter = new CookieAdapter(ExpiryType.EXPIRY);

Max Age

CookieAdapter cookieAdapter = new CookieAdapter(ExpiryType.MAXAGE);
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.