Selenium不以 - 无头模式下载报告文件
我正在尝试通过刮板从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.
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Nevermin,是网站的错。我的代码很好。
Nevermin, was fault of the website. My code was fine.