我试图从远程webdriver实例获取一些性能日志信息。我使用的是Python Selenium绑定。在
据我所知,这是我应该能得到的信息。可能只有ChromeDriver才有。但如果我想用FireFox轻松切换的话。在
不过,我对Python还不熟悉(只是在学习!)关于Python的功能字典(用于性能日志记录时)的文档似乎有点有限(或者今天早上我的googlefu很弱)。在
我发现了以下内容:
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);
看起来应该能满足我的需要。但它是爪哇。我不太确定如何将其转换为Python。假设有可能。在
有什么想法吗?在
在研究Chromedriver日志一段时间后,我发现了一个更紧凑的解决方案,可以在Chrome以外的浏览器上运行。在
这个:https://pypi.python.org/pypi/seleniumwrapper
它为导航计时API(https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html)添加了一个很好的包装器。提供了一组更紧凑的数据,更易于解释和使用。在
它放在标准硒周围的其他包装实际上也相当不错!在
如果有人想知道,这似乎对我有好处:
(假设您正在使用selenium remote)
(在添加的两个命令“getAvailableLogTypes”和“getLog”中,您只能在上面的代码片段中看到前者。后者只返回远程会话上可用日志类型的列表。)
现在我要做的就是解释它。。。。在
相关问题 更多 >
编程相关推荐