## TL;DR

Browser automation for downloads is brittle: dialogs, popups, and timing all break it. Use Concur's report export API or scheduled export delivery instead; reserve browser automation for what has no API.

## Error

```text
browser automation failed when agent tried to download the concur report
```

## Steps

1. Check whether Concur exposes the report via its export or reporting API for your plan. Expected: an API path for the same report.
2. Switch the agent to the API: request the export, poll for completion, then download the resulting file. Expected: a reliable, scriptable download.
3. If no API exists, use Concur's scheduled report delivery to a known location and have the agent pick it up there. Expected: the report arrives without browser interaction.
4. Keep browser automation only as a last resort, with explicit waits for the download event rather than fixed sleeps. Expected: less flakiness where automation is unavoidable.
5. Verify the downloaded file: check size and parse the header before processing. Expected: a complete, valid report file.

## When to use

- Browser automation fails downloading Concur reports.
- The download involves dialogs or timing-sensitive steps.

## When not to use

- The API export itself fails (debug the API call).
- The report content is wrong (check report parameters).

## Tool compatibility

- SAP Concur reporting APIs; Playwright or Selenium as fallback.

## Variant phrasings

### Could not download Concur report automatically

Same failure, generic wording.

### Report download timed out in automation

The timing-specific form.

## Why it happens

Downloads cross the browser-to-OS boundary, where automation has the least control. Dialogs, download bars, and anti-automation measures make every step fragile; APIs skip the boundary entirely.

## Provenance

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