From: ajay paswan Date: 2012-08-23T19:14:00+09:00 Subject: Re: Save a file by clicking on a link Joel Pearson wrote in post #1073000: > 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' What if I am using IE? or Chrome? I saw this for chrome but could not find for IE. > #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, What will be the name of the downloaded file? Is there any way to specify/sustomize the name of the downloaded file? For example the name of the file I want will be id+".pdf", id is a variable. > 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/.