Selenium不以 - 无头模式下载报告文件

发布于 2025-01-23 14:42:28 字数 1120 浏览 3 评论 0原文

我正在尝试通过刮板从Web报告下载Excel文件。当显示中殿时,它可以完美地运行,但是当我以无头模式尝试时,我会遇到此错误。

对可能出了什么问题有任何想法?我正在使用此选项

opc.headless = True
opc.add_argument("--start-maximized")
opc.add_argument("--window-size=1920x1080")
opc.add_argument("--enable-features=NetworkService,NetworkServiceInProcess")
opc.add_argument("--disable-dev-shm-usage")
opc.add_argument("--disable-gpu")
opc.add_argument("--no-sandbox")
opc.add_argument("--ignore-certificate-errors")
opc.add_argument("--allow-running-insecure-content")
opc.add_argument("--disable-notifications")
opc.add_argument("--disable-blink-features")
opc.add_argument("--disable-blink-features=AutomationControlled")
opc.add_argument('--disable-dev-shm-usage')
opc.add_argument("--incognito")
opc.add_argument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36")
opc.add_argument("--verbose")
opc.add_argument('enable-logging')

I'm trying to download an excel file from a web report with a scraper. It runs perfectly when the navegator is displayed, but when I try it in headless mode i get this error.
enter image description here

Any idea of what may be wrong? I'm using this options

opc.headless = True
opc.add_argument("--start-maximized")
opc.add_argument("--window-size=1920x1080")
opc.add_argument("--enable-features=NetworkService,NetworkServiceInProcess")
opc.add_argument("--disable-dev-shm-usage")
opc.add_argument("--disable-gpu")
opc.add_argument("--no-sandbox")
opc.add_argument("--ignore-certificate-errors")
opc.add_argument("--allow-running-insecure-content")
opc.add_argument("--disable-notifications")
opc.add_argument("--disable-blink-features")
opc.add_argument("--disable-blink-features=AutomationControlled")
opc.add_argument('--disable-dev-shm-usage')
opc.add_argument("--incognito")
opc.add_argument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36")
opc.add_argument("--verbose")
opc.add_argument('enable-logging')

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情话墙 2025-01-30 14:42:28

Nevermin,是网站的错。我的代码很好。

Nevermin, was fault of the website. My code was fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文