mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-17 04:32:15 +01:00
fix(chromium): add missing import for awaited waitForExpression
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
|||||||
"github.com/chromedp/cdproto/emulation"
|
"github.com/chromedp/cdproto/emulation"
|
||||||
"github.com/chromedp/cdproto/network"
|
"github.com/chromedp/cdproto/network"
|
||||||
"github.com/chromedp/cdproto/page"
|
"github.com/chromedp/cdproto/page"
|
||||||
|
"github.com/chromedp/cdproto/runtime"
|
||||||
"github.com/chromedp/cdproto/storage"
|
"github.com/chromedp/cdproto/storage"
|
||||||
"github.com/chromedp/chromedp"
|
"github.com/chromedp/chromedp"
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
@@ -708,12 +709,10 @@ func waitForExpressionBeforePrintActionFunc(logger *slog.Logger, disableJavaScri
|
|||||||
return fmt.Errorf("context done while evaluating '%s': %w", expression, ctx.Err())
|
return fmt.Errorf("context done while evaluating '%s': %w", expression, ctx.Err())
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
var ok bool
|
var ok bool
|
||||||
// If the provided expression is a async function (thenable) it will be awaited
|
// Await the result so a thenable expression (an async function
|
||||||
// (async () => {
|
// returning a Promise) resolves before its value is read. A
|
||||||
// document.querySelector('#accept').click();
|
// non-promise result is unaffected.
|
||||||
// await new Promise(r => setTimeout(r, 2000));
|
// See https://github.com/gotenberg/gotenberg/pull/1617.
|
||||||
// return true;
|
|
||||||
// })()
|
|
||||||
evaluate := chromedp.Evaluate(expression, &ok, func(p *runtime.EvaluateParams) *runtime.EvaluateParams {
|
evaluate := chromedp.Evaluate(expression, &ok, func(p *runtime.EvaluateParams) *runtime.EvaluateParams {
|
||||||
return p.WithAwaitPromise(true)
|
return p.WithAwaitPromise(true)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user