我正在使用 headless-chromium-php,但 getHtml
函数似乎获取了 html 源代码。 https://github.com/chrome-php/chrome#get-the-page-html
相反,我想让 DOM 显示在 chrome 浏览器中。所以,我该怎么做我想在浏览器渲染后获取 html 源代码。
回答1
正如您所猜测的,您需要等待页面完成加载,包括任何 javascript 渲染;查看该文档 [https://github.com/chrome-php/chrome#evaluate-script-on-the-page] 中前面的示例以获取内部 html。