# Take Screenshot — BrowserStack

> Generate screenshots for a URL across multiple browsers and devices. See the documentation

- Key: `browserstack-take-screenshot`
- Type: Action (Write)
- Version: 0.0.1
- App: BrowserStack (`browserstack`) — https://pipedream.com/apps/browserstack.md
- This page (HTML): https://pipedream.com/apps/browserstack/actions/take-screenshot
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/browserstack/actions/take-screenshot/take-screenshot.mjs

## Description

Generate screenshots for a URL across multiple browsers and devices. [See the documentation](https://www.browserstack.com/screenshots/api)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `url` | `string` | Yes | The URL of the desired page to screenshot |
| `browser` | `string[]` | Yes | The version of the browser to use Options are loaded from the connected account. |
| `winRes` | `string` | No | Screen resolution for browsers on Windows |
| `macRes` | `string` | No | Screen resolution for browsers on OSX |
| `quality` | `string` | No | Quality of the screenshot |
| `waitTime` | `integer` | No | Time in seconds to wait before taking the screenshot |
| `orientation` | `string` | No | Screen orientation for mobile devices |
| `local` | `boolean` | No | Set to true if the page is local and a Local Testing connection has been set up |
| `callbackUrl` | `string` | No | A public URL where results will be posted once processing is complete |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "browserstack",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "browserstack-take-screenshot",
  arguments: {
    url: "URL",
    browser: ["Browser"],
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "browserstack-take-screenshot",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    browserstack: { authProvisionId: "apn_xxxxxxx" },
    url: "URL",
    browser: ["Browser"],
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "browserstack-take-screenshot",
    "configured_props": {
      "browserstack": { "authProvisionId": "apn_xxxxxxx" },
      "url": "URL",
      "browser": ["Browser"]
    }
  }'
```

---

- App: https://pipedream.com/apps/browserstack.md · All apps: https://pipedream.com/apps
