I am trying to save excel file (The file is in .xls format) using selenium in python. I have used all the MIME types for .xls format. But after setting the profile right, it is still showing the dialogue box. This is the code of the profile.
profile = webdriver.FirefoxProfile()
profile.set_preference('browser.download.folderList', 2) # custom location
profile.set_preference('browser.download.manager.showWhenStarting', False)
profile.set_preference('browser.download.dir', 'F://')
profile.set_preference("browser.helperApps.alwaysAsk.force", False)
profile.set_preference('browser.helperApps.neverAsk.saveToDisk', 'application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/msexcel, application/x-msexcel,application/x-ms-excel,application/x-excel,application/x-dos_ms_excel,application/xls,application/x-xls')
driver = webdriver.Firefox(profile)
driver.get("http://agmarknet.gov.in/SearchCmmMkt.aspx?Tx_Commodity=1&Tx_State=0&Tx_District=0&Tx_Market=226&DateFrom=01-Jan-2009&DateTo=15-Aug-2018&Fr_Date=01-Jan-2009&To_Date=15-Aug-2018&Tx_Trend=0&Tx_CommodityHead=Wheat&Tx_StateHead=--Select--&Tx_DistrictHead=--Select--&Tx_MarketHead=Amritsar")
driver.find_element_by_id("cphBody_ButtonExcel").click()
How to automatically download the file and get rid of the dialogue box? I have referred to different answers on stack overflow, but nothing helped.