You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

pyppeteer无头模式无法正常渲染SSR页面 背景显示空白问题求助

问题描述

相关测试代码如下:

url = "https://loja.meo.pt/Equipamentos/gaming/Sony/PS5-Digital-Comando-DS-Plus-Card-365-dias?cor=Branco&modo-compra=PromptPayment"

browser = await launch(
        ignoreHTTPSErrors=True,
        headless=True,
        executablePath=os.getenv('CHROME_PATH'),
        args=[
          '--no-sandbox',
          '--disable-setuid-sandbox',
          '--disable-dev-shm-usage',
          '--headless',
          '--disable-gpu',
          '--ignore-certificate-errors'
        ]
)
page = await browser.newPage()

await page.setViewport({'width': 1920, 'height': 1280})

await page.goto(url, {'waitUntil': 'networkidle0'})

await page.screenshot({'path': 'screenshot.png'})
解决方案

脚本本身运行逻辑无异常,问题根源为Docker和卷挂载配置异常:多个运行相同脚本的实例读取了旧的截图和旧版本脚本,清理所有相关实例后重启脚本即可恢复正常。

内容的提问来源于stack exchange,提问作者Luis Lopes

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.27 18:36:04