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

孤街浪徒 提交于 2019-12-24 13:43:04

问题


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?


回答1:


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

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




回答2:


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

Here is similar problem Get cookies in Webdriver how?



来源:https://stackoverflow.com/questions/19366344/restassured-and-webdriver-get-and-use-a-session-id-from-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!