def add_cookie(domain, name, value, opts = {})
      path    = opts.delete(:path) || "/"
      max_age = opts.delete(:expires) || (Time.now + 60*60*24) # not sure if this is correct
      secure  = opts.delete(:secure) || false

      raise(ArgumentError, "unknown option: #{opts.inspect}") unless opts.empty?

      cookie = HtmlUnit::Util::Cookie.new(domain, name, value, path, max_age, secure)
      @webclient.getCookieManager.addCookie cookie

      cookie
    end
def add_cookie(domain, name, value, opts = {})
      path    = opts.delete(:path) || "/"
      max_age = opts.delete(:expires) || (Time.now + 60*60*24) # not sure if this is correct
      secure  = opts.delete(:secure) || false

      raise(ArgumentError, "unknown option: #{opts.inspect}") unless opts.empty?

      cookie = HtmlUnit::Util::Cookie.new(domain, name, value, path, max_age, secure)
      @webclient.getCookieManager.addCookie cookie

      cookie
    end
Add a cookie with the given parameters (Celerity only)

 @param [String] domain
 @param [String] name
 @param [String] value

 @option opts :path    [String]  ("/") A path
 @option opts :expires [Time]  (1 day from now) An expiration date
 @option opts :secure  [Boolean] (false)