我想计算 Watir 或 Selenium 中的页面加载时间
这是场景:
1. Login to a web application with username and password and hit Enter (Start timer) 2. Load the login page (lap timer split, to mark the time for page load ) 3. Click on a another page (split the lap timer) 4. Stop the stop watch
Here is the scenario:
1. Login to a web application with username and password and hit Enter (Start timer) 2. Load the login page (lap timer split, to mark the time for page load ) 3. Click on a another page (split the lap timer) 4. Stop the stop watch
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Watir 中的任何方法调用都会返回所需的时间,因此这是一项微不足道的任务。
例如,
Any method call in Watir returns how long it takes, so this is a trivial task.
For example,
所有现代浏览器都引入了新的规范。目前 Google Chrome、IE9 已内置该补丁,Mozilla 正在等待应用已提供的补丁。
这个新规范称为 WebTimings,我写了一篇 博客文章 展示如何使用 C# 访问它。访问它的方式是通过 javascript,因此可以与所有语言绑定一起使用。
所需的 JavaScript 是
这会返回一个像这样的字典
There is a new Spec being introduced into all modern browsers. Currently Google Chrome, IE9 have it built in and Mozilla is waiting to apply the patch that has been supplied.
This new spec is called WebTimings and I wrote a blog post showing how to access it using C#. The way to access it is via javascript so can be used with all language bindings.
The JavaScript needed is
This returns a dictionary like this