Can anyone let me know how to download a word file using selenium(java)? My below code is not working.
FirefoxProfile prof = new FirefoxProfile();
prof.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/word");
When I click on 'download link or icon' in the page, it prompts a popup to save the download file (see image below) and I need to click on OK
button in the popup.
Please let me know how to do this using Firefox.
Try this
import java.awt.Robot;
And use
Robot r = new Robot();
r.keyPress(KeyEvent.VK_ENTER);
r.keyRelease(KeyEvent.VK_ENTER);
This will press Enter Programatically.