Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions docs/routes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ Each route accepts the following form fields:
|-------------------|--------------------------------------------------------------------------------------------------------|---------|
| waitDelay | Duration (e.g, '5s') to wait when loading an HTML document before converting it into PDF. | None |
| waitForExpression | The JavaScript expression to wait before converting an HTML document into PDF until it returns *true*. | None |
| waitForSelector | Selector (e.g. '#id') to query before converting an HTML document into PDF until it matches a node. | None |

:::info

Expand Down Expand Up @@ -668,6 +669,37 @@ curl \
</TabItem>
</Tabs>

**waitForSelector**

Instead of waiting on an expression, you can wait until a node matching a selector query becomes visible on the page:

```js
// Somewhere in the HTML document
await promises()
const newText = document.createElement("p")
newText.id = "special-id"
document.insertBefore(newText, null)
```

<Tabs
defaultValue="curl"
values={[
{ label: 'cURL', value: 'curl', },
]
}>
<TabItem value="curl">

```bash {4}
curl \
--request POST http://localhost:3000/forms/chromium/convert/url \
--form url=https://my.url \
--form 'waitForSelector=#special-id' \
-o my.pdf
```

</TabItem>
</Tabs>

### Emulated Media Type {#emulated-media-type-chromium}

Each route accepts the following form field:
Expand Down