java - Selenium: -browser.helperApps.neverAsk.openFile and savetodisk is not working -


i have critical issue on here. please find scenario below:

  1. login
  2. click on link
  3. 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

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -