我想在 Watir 或 Selenium 中计算页面加载时间 [英] I want to calculate the page load time in Watir or Selenium
本文介绍了我想在 Watir 或 Selenium 中计算页面加载时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
场景如下:
<前>1. 使用用户名和密码登录 Web 应用程序并按 Enter(启动计时器)2.加载登录页面(分圈计时,标记页面加载时间)3.点击另一个页面(拆分单圈计时器)4.停止秒表 解决方案
Watir 中的任何方法调用都会返回所需的时间,因此这是一项微不足道的任务.
例如
b.text_field(:id, 'uid').set 用户名b.text_field(:id, 'pwd').设置密码time1 = b.button(:id, 'logon').clicktime2 = b.button(:id, 'movepage').clickputs 第一时间:#{time1} 第二时间:#{time2} 总时间:#{time1+time2}"
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
解决方案
Any method call in Watir returns how long it takes, so this is a trivial task.
For example,
b.text_field(:id, 'uid').set username
b.text_field(:id, 'pwd').set password
time1 = b.button(:id, 'logon').click
time2 = b.button(:id, 'movepage').click
puts "Time One: #{time1} Time Two: #{time2} Total Time: #{time1+time2}"
这篇关于我想在 Watir 或 Selenium 中计算页面加载时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文