Class: Watir::Browser
- Inherits:
-
Object
- Object
- Watir::Browser
- Defined in:
- lib/watir-webdriver-performance.rb
Instance Method Summary collapse
- #performance ⇒ Object
- #performance_supported? ⇒ Boolean (also: #performance_data)
- #with_performance {|PerformanceHelper.new(performance_data).munge| ... } ⇒ Object
Instance Method Details
#performance ⇒ Object
87 88 89 90 91 |
# File 'lib/watir-webdriver-performance.rb', line 87 def performance data = driver.execute_script("return window.performance || window.webkitPerformance || window.mozPerformance || window.msPerformance;") raise 'Could not collect performance metrics from your current browser. Please ensure the browser you are using supports collecting performance metrics.' if data.nil? PerformanceHelper.new(data).munge end |
#performance_supported? ⇒ Boolean Also known as: performance_data
93 94 95 |
# File 'lib/watir-webdriver-performance.rb', line 93 def performance_supported? driver.execute_script("return window.performance || window.webkitPerformance || window.mozPerformance || window.msPerformance;") end |
#with_performance {|PerformanceHelper.new(performance_data).munge| ... } ⇒ Object
98 99 100 |
# File 'lib/watir-webdriver-performance.rb', line 98 def with_performance yield PerformanceHelper.new(performance_data).munge if performance_supported? end |