栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

通过selenium进行浏览器性能测试

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

通过selenium进行浏览器性能测试

有可能更接近[什么是浏览器性能]
正在做](https://github.com/axemclion/browser-perf/wiki/Architecture)通过
收集[chrome性能
日志](https://sites.google.com/a/chrome.org/chromedriver/logging/performance-
日志)并进行分析。
为了[获得性能
日志](https://stackoverflow.com/questions/27644615/get-chrome-performance-
以及跟踪日志),通过调整loggingPrefs打开“performance”日志`
所需能力:

from selenium import webdriverfrom selenium.webdriver.common.desired_capabilities import DesiredCapabilitiescaps = DesiredCapabilities.CHROMEcaps['loggingPrefs'] = {'performance': 'ALL'}driver = webdriver.Chrome(desired_capabilities=caps)driver.get('https://stackoverflow.com')logs = [json.loads(log['message'])['message'] for log in driver.get_log('performance')]with open('devtools.json', 'wb') as f:    json.dump(logs, f)driver.close()

At this point,

devtools.json
file would contain a bunch of trace records:

[  {    "params": {      "timestamp": 1419571233.19293,      "frameId": "16639.1",      "requestId": "16639.1",      "loaderId": "16639.2",      "type": "document",      "response": {        "mimeType": "text/plain",        "status": 200,        "fromServiceWorker": false,        "enpredDataLength": -1,        "headers": {          "Access-Control-Allow-Origin": "*",          "Content-Type": "text/plain;charset=US-ASCII"        },        "url": "data:,",        "statusText": "OK",        "connectionId": 0,        "connectionReused": false,        "fromDiskCache": false      }    },    "method": "Network.responseReceived"  },  {    "params": {      "timestamp": 1419571233.19294,      "enpredDataLength": 0,      "requestId": "16639.1"    },    "method": "Network.loadingFinished"  },  ..]

现在,问题是,怎么处理它。
一个最初被建议的选项[在Google测试自动化期间]
[会议](https://www.youtube.com/watch?v=0(kAPWSZNY4)提交日志
到网页测试.org. 有一个例子
java可用此处,但是,在
现在,我还没有用Python实现它。
理论上,UI报表由网页测试.org看起来像这样:

它们还提供JSON/XML和其他格式的度量
进一步分析。
这真的很了不起,多亏了维韦克·辛格的直截了当的评论。


browser perf还使用日志记录功能来提取跟踪日志,
并对数据进行分析。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/506536.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号