selenium-webdriver - 如何在 Robot Framework 中获取 Firefox devtools Network 选项卡条目?
问题描述
我在我的机器人框架测试中面临以下问题。
在网站上进行一些测试期间,我需要捕获可以在 Firefox 开发人员工具网络选项卡中看到的日志(如以下屏幕中的示例)
我看到很多人建议使用 webdriver 实例的性能,所以我尝试使用:
def get_logsPerformance(driver):
return driver.get_log("performance")
或使用 javascript:
driver.execute_script("var performance = window.performance || window.mozPerformance || window.msPerformance || window.webkitPerformance || {}; var network = performance.getEntries() || {}; return network;")
但那些并没有给我我需要知道的东西:
- 通话状态
- 使用的方法
- 域
- 如果可能,标头、请求和响应
我需要的不是所有的性能信息,而是网络信息,例如:
driver.get_log("network")
但它似乎不存在。
我怎样才能获得这些信息?是否可以通过使用 webdriver 的属性来获得它?我也读过 BrowserMobProxy 但我真的不知道如何设置它,以防万一一步一步或配置它的基本帮助真的很感激。希望有人能帮忙,非常感谢
解决方案
推荐阅读
- android - Android - 登录谷歌 AWS Amplify - 模板格式错误:YAML 格式不正确
- flask - Flask WTForms 子表单和一个通用表单内的独立验证
- html - 强制 CSS 背景图像为 HTTPS
- haskell - 缺少结果类型?在函数长度 :: Monad m => ByteString mr -> m (Of Int r)
- docker - docker-compose 不初始化容器环境变量
- idris - 在 REPL 中使用重写
- python - 使用导入的函数保存输出变量
- c - 当您没有可执行文件的源代码时,您可以在 Eclipse 中远程调试共享对象吗?
- c# - 在绑定到 ListView 之前从 ViewModel 修改属性
- python - 如何使用 for-try-except 块杀死 jupyter 实验室单元?