I want to download the excel file from a website via selenium python. I have written a code as below. During the execution of javascript, My chrome crashed. I am not getting any error messages. Could someone please help me out?
from webdriver_manager.chrome import ChromeDriverManager
chromDriver = ChromeDriverManager().install()
driver = webdriver.Chrome(chromDriver)
driver.get("https://nrlm.gov.in/mmuMasterReport.do?methodName=getNodalOfficerList")
driver.execute_script("genrateExcel()")
CodePudding user response:
In have had a look to your website, replace below statement
driver.execute_script("genrateExcel()")
with following code and you should be able to download the excel file in your local
download_excel= driver.find_element_by_xpath("//a[@title='Download as Excel']")
download_excel.click()
CodePudding user response:
Found the issue, I was using the code with Jupiter Notebook which is creating a problem somehow. I switched to the command window and it works!
