Skip to content

Commit 4479079

Browse files
sourav-kundufrancisf
authored andcommitted
update code snippet for accessing getSessionDetails executor
1 parent fd4cd0f commit 4479079

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

sample_session_details_API.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ const clientPlaywrightVersion = cp.execSync('npx playwright --version').toString
4040
* You can use all these details after your test has completed, to fetch logs or use any other Automate REST APIs
4141
*/
4242
const resp = await JSON.parse(await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({action: 'getSessionDetails'})}`));
43-
const jsonObj = await JSON.parse(resp);
44-
console.log(jsonObj.hashed_id); // This gives the session ID of the running session
45-
console.log(jsonObj); // This prints the entire JSON response. You can use any/all of the response attributes the way you like.
43+
console.log(resp.hashed_id); // This gives the session ID of the running session
44+
console.log(resp); // This prints the entire JSON response. You can use any/all of the response attributes the way you like.
4645

4746
await browser.close();
4847
})();

0 commit comments

Comments
 (0)