草庐IT

python - 通过 Selenium : "Allowing web_page contexts requires supplying a value for matches" 的 Chrome Webdriver 错误消息

coder 2023-08-18 原文

我正在运行一个已编译的 Python 脚本,该脚本使用 Selenium 启动一个 Chrome Webdriver session ,该 session 访问一个站点并执行一些任务。该脚本的行为与我预期的一样,除了它在我第一次启动 webdriver 时向控制台打印一条“错误”消息。错误如下:

[2460:7268:1121/133303:ERROR:base_feature_provider.cc(122)] manifestTypes: Allowing web_page contexts requires supplying a value for matches.

谁知道这是什么意思?就像我上面所说的,脚本的行为似乎符合我的预期,这让我想知道这条消息试图表明什么。谷歌搜索这个短语会出现大量的 code.google 页面,这些页面提到但没有清楚地描述相同的错误。我可以发布代码,但它太长(2000 多行)并且我不确定哪些行与问题相关,因为我无法理解错误消息。我通常使用带有 Selenium 的 Firefox 浏览器,但正在探索 Chrome 作为替代方案。无论如何,如果有人可以帮助我理解此错误消息,我将不胜感激。

最佳答案

您可以忽略该消息,因为它是 ChromeDriver 日志记录的一部分。如果您想隐藏这些消息,您可以使用 -silent 标志启动 ChromeDriver。

这应该可以解决问题

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("-silent")
driver = webdriver.Chrome(chrome_options=chrome_options)

关于python - 通过 Selenium : "Allowing web_page contexts requires supplying a value for matches" 的 Chrome Webdriver 错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20129574/

有关python - 通过 Selenium : "Allowing web_page contexts requires supplying a value for matches" 的 Chrome Webdriver 错误消息的更多相关文章

随机推荐