Watir给Amazon.cn充礼品卡

写个脚本去尝试不花钱给自己的Amazon.cn账号充礼品卡,碰碰运气。

#encoding: UTF-8                                          #添加这一行才可以处理中文
require 'rubygems'                                        #gem install xxx --no-ri --no-rdoc
require 'timeout'
require 'watir-webdriver'

def randCharOfLength(len)                                 #产生随机任意长度的数
    chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
    str = ""
    1.upto(len) {|i| str << chars[rand(chars.size-1)]}
    return str
end
b = Watir::Browser.new(:firefox ...
more ...