RESTAssured and WebDriver: get and use session id from browser

I am trying to use WebDriver to get the session id from the browser being checked so that I can pass that id via given (). session (string) functions in RESTAssured. The browser will log in normally to create a session ID. Any ideas how to grab it?

+1


source to share


2 answers


You can get your session id by putting the driver object in RemoteWebDriver like this



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

+2


source


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



Here is a similar problem Get cookies in Webdriver how?

+1


source







All Articles