【发布时间】:2022-01-18 09:18:42
【问题描述】:
当启动 chrome per python selenium webdriver script 时,我没有获得 特定 chrome 选项以正常工作。
目标是在 python selenium 脚本中使用假网络摄像头启动 chrome,该摄像头播放视频文件。
有问题的选项是“use-file-for-fake-video-capture”结合“use-fake-device-for-media-stream”:
options.add_argument("--use-fake-device-for-media-stream")
options.add_argument("--use-file-for-fake-video-capture=C:\Testfiles\videofiles\bus_cif.y4m")
在带有 chrome.exe 的批处理文件中使用这两个选项都可以正常工作。例如,以下批次工作 fine 并使用了伪造的网络摄像头视频文件:
"C:\Program Files\Google\Chrome\Application\chrome.exe" --use-fake-device-for-media-stream --use-file-for-fake-video-capture=C:\Testfiles\videofiles\bus_cif.y4
另外,我的 python chrome webdriver 脚本选项的其余部分工作正常,所以代码本身应该是正确的。例如,以下选项工作很好:
options.add_argument("--allow-file-access-from-files")
options.add_argument("--use-fake-ui-for-media-stream")
options.add_argument("--disable-infobars")
Chrome 97.x(带有最新稳定的 chromium webdriver 文件)
在带有选项的 python 脚本中使用“use-file-for-fake-video-capture”选项有什么特别之处吗?或者路径必须是另一种格式?
非常感谢!
【问题讨论】:
标签: python selenium google-chrome selenium-webdriver selenium-chromedriver