Ruby WATIR easy browser automation

I needed to run 100 accounts through on 6 different URLs and record end user response times. In less than 30 lines of code Ruby WATIR did the job for me.

require 'thread'
require 'watir'

url     = ARGV[0]
acc_in     = ARGV[1]
log_out = ARGV[2]

def Login(url, ie)
ie.goto(url)
ie.text_field(:name,'txtUsername').set 'nicks'
ie.text_field(:id,'txtPassword').set 'xxxxxxxx'
ie.button(:id,'btnLogon').click
end

def search_account(accnum, ie, log_out)
ie.frame(:id, 'iFMain').text_field(:id,'txtAccNumber').set accnum
start = Time.now
ie.frame(:id, 'iFMain').button(:id,'btnDisplay').click
diff = Time.now - start
File.open(log_out, 'a') do |f2|
f2.puts "#{start} , #{diff},  #{accnum.strip} "
end
return
end

ie = Watir::Browser.new
Login(url, ie)

IO.foreach(acc_in) do |line|
search_account(line, ie, log_out)
end

Prezi from Chris Delorenzo Performance Test Lead Tabcorp

Great presentation from Chris Delorenzo Performance and Automation Lead @ Tabcorp – includes High Volume Cloud performance testing being conducted on one of the highest hit portal sites in Australia , plus Big Data and some automation insights.

Link: http://prezi.com/-hkkej5mggxd/

Join us at next CMGA _ Nick Singh is speaking 06/08/14

CMG Australia Meetup, August 6th 2014

Wednesday, Aug 6, 2014, 5:45 PM

The Apartment
401 Little Bourke Street

32 CMGites Attending

Team,IBM has offered to host the next CMG Australia Meetup. Light refreshments (Beer, Pizza, etc.) will be provided. The August 2014 meetup will be held at The Apartment. Details for the meetup are provided below:Guest Speaker : Annie Lin on Measuring Performance Early On: Service Virtualization To The RescueAbstract : Most systems being built …

Check out this Meetup →