如何使用watir webdriver性能获取Ajax性能数据
如何使用watir webdriver性能获取Ajax性能数据 当我使用下面的脚本时,我在触发Ajax请求后得到了相同的结果如何使用watir webdriver性能获取Ajax性能数据,ajax,performance,watir-webdriver,performance-testing,Ajax,Performance,Watir Webdriver,Performance Testing,如何使用watir webdriver性能获取Ajax性能数据 当我使用下面的脚本时,我在触发Ajax请求后得到了相同的结果 require 'rubygems' gem "selenium-webdriver" require 'watir-webdriver' require 'watir-webdriver-performance' Selenium::WebDriver::Chrome.path = chromePath b = Watir::Browser.new :chrome
require 'rubygems'
gem "selenium-webdriver"
require 'watir-webdriver'
require 'watir-webdriver-performance'
Selenium::WebDriver::Chrome.path = chromePath
b = Watir::Browser.new :chrome
b.goto 'Ajax Website'
p b.performance.summary
# click some ajax button to trigger server request
p b.performance.summary
# click some ajax button to trigger server request
p b.performance.summary
b.close
输出
{:time_to_first_byte=>396, :request=>395, :tcp_connection=>0, :app_cache=>0, :time_to_last_byte=>405, :redirect=>679, :response=>9, :dns=>0, :response_time=>6134, :dom_processing=>4041}
{:time_to_first_byte=>449, :request=>446, :tcp_connection=>0, :app_cache=>0, :time_to_last_byte=>458, :redirect=>2320, :response=>9, :dns=>0, :response_time=>3751, :dom_processing=>946}
{:time_to_first_byte=>449, :request=>446, :tcp_connection=>0, :app_cache=>0, :time_to_last_byte=>458, :redirect=>2320, :response=>9, :dns=>0, :response_time=>3751, :dom_processing=>946}
我确实在页面上用Ajax触发了一些对服务器的请求。