Reputation: 3736
When I use getSessionId()
to fetch Session ID of current window which should be identified by current driver
. Code like this.
String sessionId = ((RemoteWebDriver) driver).getSessionId().toString();
The value of sessionId
is different with JSESSIONID
in chrome Resources->Cookies->JSESSIONID
.
Does RemoteWebDriver
not get the correct value? How to do get correct session id? Thanks.
Upvotes: 0
Views: 5863
Reputation: 5080
Try this:
//Assume Wed Driver is initiated properly
Cookie cookie= driver.manage().getCookieNamed("JSESSIONID");
System.out.println(cookie.getValue());
Upvotes: 4