Skip to content

Instantly share code, notes, and snippets.

@alisterscott
Created June 6, 2012 11:04
Show Gist options
  • Save alisterscott/2881288 to your computer and use it in GitHub Desktop.
Save alisterscott/2881288 to your computer and use it in GitHub Desktop.
Benchmarking the performance of a .set operation on a text field across browsers using watir-webdriver in ruby
require 'selenium-webdriver'
require 'watir-webdriver'
require 'bench'
d = Selenium::WebDriver.for :chrome, native_events: true
b = Watir::Browser.new d
b.goto 'bing.com'
benchmark 'set chrome native' do
b.text_field(name: 'q').set 'ghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghgh'
end
run 10
b.close
require 'selenium-webdriver'
require 'watir-webdriver'
require 'bench'
b = Watir::Browser.new :chrome
b.goto 'bing.com'
benchmark 'set chrome non-native' do
b.text_field(name: 'q').set 'ghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghgh'
end
run 10
b.close
require 'selenium-webdriver'
require 'watir-webdriver'
require 'bench'
b = Watir::Browser.new :firefox
b.goto 'bing.com'
benchmark 'set firefox' do
b.text_field(name: 'q').set 'ghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghgh'
end
run 10
b.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment