我正在尝试从远程 webdriver 实例取回一些性能日志信息。我正在使用 Python Selenium 绑定。
据我所知,这是我应该能够得到的信息。认为它可能仅适用于 ChromeDriver。我目前正在使用 FireFox,但如果它获得我想要的信息,可以轻松切换。
但是,我是 Python 的新手(但正在学习!),围绕 Python 的功能字典(用于性能日志记录时)的文档似乎有点有限(或者我的 google-fu 今天早上很弱)。
我发现了以下内容:
DesiredCapabilities caps = DesiredCapabilities.chrome();
LoggingPreferences logPrefs = new LoggingPreferences();
logPrefs.enable("performance", Level.INFO);
caps.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);
driver = new RemoteWebDriver("http://localhost:9515", caps);
看起来它应该做我需要的。但它是Java。我不太确定如何将其转换为 Python。假设这是可能的。
有任何想法吗?