---
title: Get Session Details with Puppeteer | TestingBot
description: Documentation on how to retrieve the Puppeteer Session Details during
  your tests
source_url:
  html: https://testingbot.com/support/web-automate/puppeteer/get-session-details
  md: https://testingbot.com/support/web-automate/puppeteer/get-session-details/index.md
---
# Get Puppeteer Session Details

When a Puppeteer test runs on TestingBot, it will generate various artifacts such as logs, video, screenshots and other files.   
 TestingBot will save these files for later retrieval, through our member dashboard or the TestingBot [REST API](https://testingbot.com/support/api).

To fetch these details through our REST API, you will need to know the unique identifier for each test.   
 TestingBot provides a `sessionId` which you can retrieve during your test, to use in REST API calls.

## Fetch the sessionId

To fetch the sessionId in your Puppeteer script, you can use the custom TestingBot command:

    const testingBotResponse = await page.evaluate(_ => {}, `testingbot_executor: ${JSON.stringify({action: 'getSessionDetails'})}`)

The response will contain a `sessionId`, which is a unique identifier for this test. You can then use this sessionId with the [TestingBot REST-API](https://testingbot.com/support/api).

    const TestingBot = require('testingbot-api');
    const tb = new TestingBot({
        api_key: 'API_KEY',
        api_secret: 'API_SECRET'
    })
    
    const puppeteer = require('puppeteer-core')
    
    (async () => {
        const capabilities = {
            'tb:options': {
                key: process.env.TB_KEY,
                secret: process.env.TB_SECRET
            },
            browserName: 'chrome',
            browserVersion: 'latest'
        }
        const browser = await puppeteer.connect({
          browserWSEndpoint: `wss://cloud.testingbot.com/puppeteer?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
        })
    
        const page = await browser.newPage()
        await page.goto('https://testingbot.com')
    
        const testingBotResponse = await page.evaluate(_ => {}, `testingbot_executor: ${JSON.stringify({action: 'getSessionDetails'})}`)
        const sessionId = testingBotResponse.sessionId
        const testData = { "test[success]" : "1", "test[status_message]" : "test" };
        await new Promise((resolve) => tb.updateTest(testData, sessionId, function(error, testDetails) { resolve(testDetails) }))
    
        console.log(`Your unique TestingBot SessionId is ${sessionId}`)
        await browser.close()
    })()

Was this page helpful? Yes No 

## Looking for More Help?

Have questions or need more information?   
 You can reach us via the following channels:

- [Email us](https://testingbot.com/contact/new)
- [Join our Slack Channel](https://join.slack.com/t/testingb0t/shared_invite/zt-3bcw9xch-jk19~6XPs_xBrsAgAedkCw)
