Class: Watir::Browser

Inherits:
Object
  • Object
show all
Defined in:
lib/watir-performance.rb

Overview

Extending Watir Browser See Documentation Here www.rubydoc.info/gems/watir/

Instance Method Summary collapse

Instance Method Details

#performanceObject

Raises:


114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/watir-performance.rb', line 114

def performance
  data = case driver.browser
         when :internet_explorer
           script = 'return JSON.stringify(window.performance.toJSON());'
           cmd = driver.execute_script(script)
           ::Object::JSON.parse(cmd)
         else
           driver.execute_script(PERFORMS)
         end
  raise ERRORMESSAGE if data.nil?
  PerformanceHelper.new(data).munge
end

#performance_supported?Boolean Also known as: performance_data

Returns:

  • (Boolean)

127
128
129
# File 'lib/watir-performance.rb', line 127

def performance_supported?
  driver.execute_script(PERFORMS)
end

#with_performance {|PerformanceHelper.new(performance_data).munge| ... } ⇒ Object

Yields:


132
133
134
# File 'lib/watir-performance.rb', line 132

def with_performance
  yield PerformanceHelper.new(performance_data).munge if performance_supported?
end