I am trying to download a csv file from a website using selenium python and am having problems when conducting the actual download. While the file does download, it is supposed to be a csv file, but is instead showing up as an incomplete .tmp file (the real csv should have 50,000+ lines, whereas the .tmp file only has <100). When I download the file from the site manually, the proper and complete csv file is downloaded. Here is the code:
chromeDriver = config.get_prop('CHROME_DRIVER_PATH')
chromeOpts = Options()
prefs = {"download.default_directory":
"DESTINATION DIRECTORY (THIS WORKS)",
}
chromeOpts.add_experimental_option("prefs", prefs)
driver = webdriver.Chrome(executable_path=chromeDriver, options=chromeOpts)
driver.get("https://oasishub.co/login/?next=/downloads/b2a11100-eac5-4d10-869a-87ba064ede2d")
usernameInput = driver.find_element_by_name("name")
passwordInput = driver.find_element_by_name("password")
usernameInput.send_keys("PROPER USERNAME (LEFT OUT)")
passwordInput.send_keys("PROPER PASSWORD (LEFT OUT)")
driver.find_element_by_xpath('//button[normalize-space()="Login"]').click()
licenseAgreeButton = driver.find_element_by_name("agree")
licenseAgreeButton.click()
driver.find_element_by_xpath("//input[@value='Get the resource']").click()
Any help and/or ideas would be greatly appreciated! Thanks!