From ce4e8970e62622b011b2bbb90b13d82323dfd913 Mon Sep 17 00:00:00 2001 From: Daniel Moran Date: Sat, 17 Jan 2026 08:40:16 -0800 Subject: [PATCH] Document `waitForSelector` option Documentation for https://github.com/gotenberg/gotenberg/pull/1446 --- docs/routes.mdx | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/docs/routes.mdx b/docs/routes.mdx index 5d2b74a..c3d9a42 100644 --- a/docs/routes.mdx +++ b/docs/routes.mdx @@ -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 @@ -668,6 +669,37 @@ curl \ +**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) +``` + + + + +```bash {4} +curl \ +--request POST http://localhost:3000/forms/chromium/convert/url \ +--form url=https://my.url \ +--form 'waitForSelector=#special-id' \ +-o my.pdf +``` + + + + ### Emulated Media Type {#emulated-media-type-chromium} Each route accepts the following form field: