05.手机浏览器的性能分析(硬埋点)

发布时间 2023-12-27 16:06:20作者: 想要暴富的小男孩

1. https://www.w3.org/TR/navigation-timing/

 2.资源加载指标

prompt forunload:访问一个新页面时,旧页面卸载完成的时间。

redirect:重定向,用户注销登陆时返回主页面和跳转到其它的网站等

app cache:检查缓存,是否打开
DNS(域名系统):DNS查询的时间,如果是长连接或者请求文件来自缓存等本地存储则返回fetchStart时间点

3.自动化获取性能指标
appium/selenium的ExecuteScript Api
注入js(埋点)
return JSON.stringify(window.performance.timing)

class TestData:
def test_data(self):
driver = webdriver.Chrome()
driver.get("https://ceshiren.com")
print(driver.execute_script("return JSON.stringify(window.performance.timing)"))

JSON.stringify(window.performance.getEntriesByName

(document.querySelector("img").src)[0], null, 2)