java - Selenium: -browser.helperApps.neverAsk.openFile and savetodisk is not working -
i have critical issue on here. please find scenario below:
- login
- click on link
- after click, new tab opens
i have switched focus new opened tab following code
arraylist<string> newtab = new arraylist<string>(driver.getwindowhandles()); driver.switchto().window(newtab.get(1));
the issue when try click on excel download link on newly opened tab, "open with" popup appearing , automation fails. after adding following preference
firefoxprofile.setpreference("browser.helperapps.neverask.openfile", "text/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); firefoxprofile.setpreference("browser.helperapps.neverask.savetodisk", "text/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
please, can suggest feasible solution possible?
thank you
please manually set these preferences in firefox's(about:config) section, visit application, click link , see if file gets downloaded without prompt. identify issues automation.
i tried setting these preferences in firefox, still prompts download window. can download without prompt after checking "do automatically files on" updates mimetypes.rdf
file in profile directory. make work through automation, may need bundle custom firefox profile includes mimetypes.rdf
testsuite.
here's code create firefoxprofile given profile directory:
firefoxprofile profile = new firefoxprofile(new file("<path_to_firefox_profile_directory_that_works_when_tested_manually>"); webdriver driver = new firefoxdriver(profile);
Comments
Post a Comment