> ## Documentation Index
> Fetch the complete documentation index at: https://intunedhq.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Trigger

A union type representing different methods to trigger file downloads in web automation.

This type alias standardizes how download operations can be initiated, providing
multiple approaches to suit different automation scenarios.

```python theme={null}
type Trigger = str | Locator | Callable[[Page], None] | Callable[[Page], Awaitable[None]]
```

Type Information:

* `str`: Direct URL string to download from
* `Locator`: Playwright Locator object pointing to a clickable download element
* `Callable[[Page], None]` | `Callable[[Page], Awaitable[None]]`: Custom async function that takes a Page and triggers the download

## Examples

```python URL String Trigger theme={null}
from typing import TypedDict
from playwright.async_api import Page
from intuned_browser import download_file
class Params(TypedDict):
    pass
async def automation(page: Page, params: Params, **_kwargs):
    # Direct download from URL
    download = await download_file(
        page,
        trigger="https://intuned-docs-public-images.s3.amazonaws.com/32UP83A_ENG_US.pdf"
    )
```

```python Locator Trigger theme={null}
from typing import TypedDict
from playwright.async_api import Page
from intuned_browser import download_file
class Params(TypedDict):
    pass
async def automation(page: Page, params: Params, **_kwargs):
    await page.goto("https://sandbox.intuned.dev/pdfs")
    # Click a download button
    download = await download_file(
        page,
        trigger=page.locator("xpath=//tbody/tr[1]//*[name()='svg']")
    )
```

```python Callback Trigger theme={null}
from typing import TypedDict
from playwright.async_api import Page
from intuned_browser import download_file
class Params(TypedDict):
    pass
async def automation(page: Page, params: Params, **_kwargs):
    await page.goto("https://sandbox.intuned.dev/pdfs")
    # Custom download logic
    download = await download_file(
        page,
        trigger=lambda p: p.locator("xpath=//tbody/tr[1]//*[name()='svg']").click()
    )
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.