Skip to content

Instantly share code, notes, and snippets.

@jarib
Forked from alisterscott/bench.rb
Created September 15, 2011 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jarib/1219170 to your computer and use it in GitHub Desktop.
Save jarib/1219170 to your computer and use it in GitHub Desktop.
require 'selenium-webdriver'
require "benchmark"
profile = Selenium::WebDriver::Firefox::Profile.new
profile.native_events = false
d = Selenium::WebDriver.for :firefox, :profile => profile
d.navigate.to "file:///#{Dir.pwd}/test.html"
e = d.find_element(:id => "q")
TESTS = 30
Benchmark.bmbm do |results|
results.report("clear + send_keys:") { TESTS.times {
e.clear
e.send_keys("A LONG UPPER CASE STRING IS BEING SET")
}
}
end
d.quit
C:\Projects\EtsyWatirWebDriver>gem install selenium-webdriver -v 2.5.0
Fetching: selenium-webdriver-2.5.0.gem (100%)
Successfully installed selenium-webdriver-2.5.0
1 gem installed
C:\Projects\EtsyWatirWebDriver>ruby bench.rb
Rehearsal ------------------------------------------------------
clear + send_keys: 0.020000 0.120000 0.140000 ( 1.371973)
--------------------------------------------- total: 0.140000sec
user system total real
clear + send_keys: 0.010000 0.030000 0.040000 ( 1.642361)
C:\Projects\EtsyWatirWebDriver>gem install selenium-webdriver -v 2.6.0
Fetching: selenium-webdriver-2.6.0.gem (100%)
Successfully installed selenium-webdriver-2.6.0
1 gem installed
C:\Projects\EtsyWatirWebDriver>ruby bench.rb
Rehearsal ------------------------------------------------------
clear + send_keys: 0.000000 0.390000 0.390000 (121.938344)
--------------------------------------------- total: 0.390000sec
user system total real
clear + send_keys: 0.000000 0.381000 0.381000 (121.711022)
<html>
<body>
<input id=q type=text>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment