From: Joel Pearson Date: 2012-08-23T03:55:04+09:00 Subject: Re: Save a file by clicking on a link 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/.