可以统计单个web页面加载时间。

require 'watir-webdriver'
require 'watir-webdriver-performance'
b = Watir::Browser.new :chrome
b.goto "http://172.17.3.54:230/"
#获取加载当前页面所有参数
puts b.performance.to_s.gsub(', ',", \n")
puts "--------------------------分割线--------------------------"
#我们关心的主要是页面加载时长:response_time,转换为S输出
load_secs = b.performance.summary[:response_time]/1000.0
puts "Load Time:#{load_secs} seconds."
sleep 1
b.close

 

执行结果如下:

ruby web性能响应时间

相关文章:

  • 2022-12-23
  • 2021-05-18
  • 2022-12-23
  • 2021-10-28
  • 2022-12-23
  • 2021-12-01
  • 2021-12-27
  • 2021-04-07
猜你喜欢
  • 2021-08-20
  • 2022-01-13
  • 2021-07-20
  • 2022-12-23
  • 2021-08-18
相关资源
相似解决方案