I'll assume that you're referring to webdriver and a link within a 
browser.
My code is written for Firefox, so you'll need to modify it for 
whichever browser you're using, but it might give you an idea.

Code:

@profile = Selenium::WebDriver::Firefox::Profile.from_name 'default' 
#Use new if you want a fresh profile rather than your normal one

@profile['browser.download.folderList'] = 2 # custom location setting
@profile['browser.download.dir'] = @download_directory
@profile['browser.helperApps.neverAsk.saveToDisk'] = "application/pdf, 
application/octet-stream, text/xml" #Add the appropriate MIME type here 
if you have problems

#Open firefox with your modified profile
@@driver = Watir::Browser.new :firefox, :profile => @profile

-- 
Posted via http://www.ruby-forum.com/.