不等待PuppeterSharp异步javascript函数

不等待PuppeterSharp异步javascript函数,javascript,async-await,puppeteer-sharp,Javascript,Async Await,Puppeteer Sharp,当我使用puppetersharp加载包含异步函数的网页时,异步函数中的代码永远不会运行(或者不等待,我不确定是哪个) C#代码: Javascript代码: onmount = () => { const params = new URLSearchParams(document.location.search); const code = params.get('code'); // search is an async func

当我使用puppetersharp加载包含异步函数的网页时,异步函数中的代码永远不会运行(或者不等待,我不确定是哪个)

C#代码:

Javascript代码:

   onmount = () => {
        const params = new URLSearchParams(document.location.search);
        const code = params.get('code');

        // search is an async function (not included here for brevity)
        search(code).then(result => {
            this.el.classList.add('complete'); // not executed
            this.updateTitle(result.name);  
        });
    };
异步javascript在浏览器中按预期工作,但不是通过Puppeter/Chromium


有人知道为什么会这样吗?

当我以无头运行Puppeter并检查页面时,我收到一个由api调用引起的错误证书授权无效错误。现在一切都好了

   onmount = () => {
        const params = new URLSearchParams(document.location.search);
        const code = params.get('code');

        // search is an async function (not included here for brevity)
        search(code).then(result => {
            this.el.classList.add('complete'); // not executed
            this.updateTitle(result.name);  
        });
    };