$ gem install watir-webdriver
https://code.google.com/p/chromedriver/downloads/list
- For Macs download chromedriver_mac32_2.2.zip
$ sudo mv ~/Downloads/chromedriver /usr/local/bin/
$ ruby guest_list.rb
$ gem install watir-webdriver
https://code.google.com/p/chromedriver/downloads/list
$ sudo mv ~/Downloads/chromedriver /usr/local/bin/
$ ruby guest_list.rb
first_name;last_name;email;guests;gender | |
jkai;hsu | |
rita;jindawong | |
fred;tandem | |
daniella;kaufman | |
sam;samskies | |
annie;zhou | |
jon;oei | |
christine;hsu | |
michael;hom | |
garrett;spitzer | |
karen;liu | |
melvin;yuen | |
gloria;zhu | |
johnny;guo | |
jenny;chin | |
larry;yau | |
stephen;nguyen | |
janet;tsai | |
molly;zee | |
adam;sartell | |
jenny;lum | |
oren;shiran | |
ambert;ho | |
brian;nguyen | |
matthew;hague | |
amy;chan | |
karl;hu | |
james;moony | |
kris;hines | |
sai-kit;chan | |
teri;yu | |
kevin;ko | |
jessica;liu | |
vivian;cheng | |
tracy;chow | |
celia;wong | |
evan;kuo | |
alice;lee | |
lisa;tran | |
myron;lee | |
peter;wong | |
rachel;zuzu | |
rohan;jain | |
kelly;miyashiro | |
brendan;hong | |
nam;hoang | |
matthew;liu | |
jay;lim | |
steve;cho | |
jessica;fu | |
chrystle;cu | |
catherine;cu | |
annie;phan | |
david;nguyen | |
diana;weng | |
joesph;anderson | |
diana;park | |
caitlin;harrington | |
joesph;silvashy | |
maya;swanson | |
karen;tran | |
jammie;presto | |
emily;basileo | |
kira;tsogoo | |
mia;chinbolor | |
annika;kapur | |
jesse;molina | |
feina;zheng | |
jasmine;chen | |
leyen;chang | |
hugh;chow |
require 'watir-webdriver' | |
@browser = Watir::Browser.new :chrome | |
@url = 'http://venuedriver.com/audiosfd/apps/web/guestlist' | |
@file = 'guest_list.csv' | |
@guests = [] | |
@email_type = [ '@gmail.com', '@yahoo.com', '@outlook.com'] | |
@guest_count = ['+1','+2','+3','+4','+5'] | |
@sex = ['male', 'female'] | |
@char = ['','.','_'] | |
CSV.foreach(@file, :headers => true, :col_sep => ?;) { |csv_obj| @guests << csv_obj.to_hash } | |
@guests.each do |guest| | |
guest['email'] = guest['first_name'] + @char.sample + guest['last_name'] + @email_type.sample | |
guest['guests'] = @guest_count.sample | |
guest['gender'] = @sex.sample | |
end | |
@browser.goto(@url) | |
@guests.each do |guest| | |
@browser.goto(@url) | |
@browser.select_list(:id, 'event').select('PIERCE FULTON Aug 17') | |
@browser.text_field(:name => 'first').set(guest['first_name']) | |
@browser.text_field(:name => 'last').set(guest['last_name']) | |
@browser.text_field(:name => 'email').set(guest['email']) | |
@browser.select_list(:name, 'extra_count').select(guest['guests']) | |
@browser.radio(:id, guest['gender']).set() | |
@browser.button(:id, 'submitButton').click | |
end |
Hi