TL;DR: Skip the browser entirely and run `wrangler whoami`. The account id is printed right there in the output, so there is no reason to automate the dashboard to copy it.

```text
browser automation failed on cloudflare dashboard when agent tried to copy the account id
```

## Steps

1. Run `wrangler whoami` in the agent's environment.
   Expected: output includes the account name and the account id.
2. Copy the account id from that output into whatever needs it (API calls, config, runbook variables).
   Expected: the id is available with no dashboard visit.
3. If wrangler is not authenticated, authenticate with an API token first (see the token-auth skill), then repeat step 1.
   Expected: `wrangler whoami` succeeds.
4. Delete the dashboard-scraping step from the agent's runbook.
   Expected: this failure mode disappears permanently.

## Use this when

- An agent opens the Cloudflare dashboard in a browser to read the account id
- Dashboard automation flakes on selectors, logins, or page loads
- You need the account id for API calls or wrangler config

## Not for this skill when

- You need something only the dashboard shows (rare; the API covers nearly everything)
- wrangler is not installed in the agent's environment (install it first)
- The goal is a UI test of the dashboard itself

## Variant phrasings

- get cloudflare account id without dashboard
- wrangler whoami account id
- agent copy account id from cloudflare dashboard fails
- find cloudflare account id programmatically

## Why it happens

The account id is visible in the dashboard URL and overview page, so agents reach for browser automation to grab it. But wrangler already knows the account from its own authentication state and prints it on demand. The browser path adds login flows, SPA timing, and selector fragility to fetch a value the CLI hands over in one command.

## Edge cases

- With multiple accounts on one token, `wrangler whoami` lists them all; pick the right one by name.
- If the token lacks account visibility scopes, the id may be hidden; widen the token scopes and retry.
- Dashboard URLs also embed the account id, but parsing them is just as brittle as scraping; prefer whoami.
- In CI, export the account id as an environment variable once instead of querying it every run.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_HKFXsUQgLdSCCcF7ioAnUA
