Hi
sridhar,
first create a browser profile by bellow code and than in @test click on download img link, it will save yr img file to mansion path in profile .......
try this .... might be will help u....
DesiredCapabilities browserCapabillities = DesiredCapabilities.firefox();
browserCapabillities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
FirefoxProfile firefoxprofile = new FirefoxProfile();
firefoxprofile.setEnableNativeEvents(true);
firefoxprofile.setAssumeUntrustedCertificateIssuer(true);
// set the Profile to download file without asking save or to store location.
firefoxprofile.setPreference("browser.download.folderList", 2); // (browser.download.folderList are internal methods of the FF profile and 2 is the corresponding value of the location.)
firefoxprofile.setPreference("browser.download.dir", "C:\\Users\\abhishek.singh\\Downloads\\Selenium"); // path where I have to store the file.
firefoxprofile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/msword,application/csv,text/csv,application/pdf"); //Add the MIME code of your file here.
//firefoxprofile.setPreference("browser.download.manager.showWhenStarting", "false");
firefoxprofile.setPreference("browser.download.useDownloadDir", "false");
webDriver = new FirefoxDriver(firefoxprofile);
Abhishek