Skip to content

Instantly share code, notes, and snippets.

@alisterscott
Created September 20, 2011 23:50
Show Gist options
  • Save alisterscott/1230762 to your computer and use it in GitHub Desktop.
Save alisterscott/1230762 to your computer and use it in GitHub Desktop.
simple watir-webdriver threading example for load testing
require 'thread'
require 'watir-webdriver'
def test_google
3.times do
browser = Watir::Browser.start 'http://www.etsy.com', :chrome
browser.text_field(:name, 'search_query').set 'hat'
start_time = Time.now
browser.button(:text, 'Search').click
end_time = Time.now
puts end_time - start_time
browser.close
end
end
threads = []
30.times do
threads << Thread.new {test_google}
end
threads.each {|x| x.join}
@ananth99
Copy link

Works great for a maximum of ten concurrent instances. How would you suggest scaling this up to 30-40 concurrent instances??

@ananth99
Copy link

My local machine goes out of memory once I try to load 30 browsers at a time. Tried headless also. Haven't had much luck. :(

@ikosalander
Copy link

Thanks for this code !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment