首页 > 解决方案 > 不允许启动 AudioContext。必须恢复(或创建)

问题描述

所以我的脚本由于某种原因现在在我运行它时给了我当前的错误。它是一个硒项目,可以无头打开浏览器。它工作得很好。

DevTools listening on ws://127.0.0.1:50010/devtools/browser/a0bd7321-8810-4867-9a1a-44830cabb881
[0531/093705.662:INFO:CONSOLE(483)] "The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#webaudio", source: https://thesite/TSPD/082a057379ab2000e04675d6650b7d08e00fa87e834636f3276a953aff91cafadccfc9f4abbb23b7?type=8 (483)
[0531/093705.665:INFO:CONSOLE(483)] "The ScriptProcessorNode is deprecated. Use AudioWorkletNode instead. (https://developers.google.com/web/updates/2017/12/audio-worklet)", source: https://thesite/TSPD/082a057379ab2000e04675d6650b7d08e00fa87e834636f3276a953aff91cafadccfc9f4abbb23b7?type=8 (483)
[0531/093705.668:INFO:CONSOLE(487)] "The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#webaudio", source: https://thesite/TSPD/082a057379ab2000e04675d6650b7d08e00fa87e834636f3276a953aff91cafadccfc9f4abbb23b7?type=8 (487)
[0531/093705.668:INFO:CONSOLE(488)] "The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#webaudio", source: https://thesite/TSPD/082a057379ab2000e04675d6650b7d08e00fa87e834636f3276a953aff91cafadccfc9f4abbb23b7?type=8 (488)
[0531/093705.669:ERROR:web_contents_delegate.cc(225)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.

我打算称该站点为“thesite”,因为它是私有的。

标签: pythonselenium

解决方案


所以我找到了错误和信息的答案:控制台。

对于我刚刚添加的错误:

options.add_argument("--use-fake-ui-for-media-stream")

对于信息:控制台:

options.add_argument("--log-level=3")

推荐阅读