Taelus
Taelus

Reputation: 277

RESTAssured and WebDriver: get and use a session id from browser

I'm trying to use WebDriver to get the session ID from the browser being tested so that I can pass that ID in through the given().session(string) functionality in RESTAssured. The browser will go through a normal login to create the session ID. Any ideas how to capture it?

Upvotes: 1

Views: 4679

Answers (2)

Scott Arg
Scott Arg

Reputation: 46

You can get your session id by casting the driver object to RemoteWebDriver like this

String session = ((RemoteWebDriver) driver).getSessionId().toString();

Upvotes: 2

irla
irla

Reputation: 489

Maybe you could just read it from cookie. Or I don't understand the problem.

Here is similar problem Get cookies in Webdriver how?

Upvotes: 1

Related Questions