I click on a download button using Python with Selenium, and an Excel file gets downloaded. Is there any way to have it open with Pandas without hardcoding the default download folder? If I know the download location, I do this to open the latest downloaded file, and it works well:
downloadsFolder = '../../Downloads/' + "*.xlsx"
list_of_files = glob.glob(downloadsFolder)
latest_file = max(list_of_files, key=os.path.getctime)
file_content = pandas.read_excel(latest_file)
I want my script to be run on multiple machines though so hardcoding the path for the default download folder is not going to work. Is there a way to figure out the download location with Python? Or is there maybe a way to just open on a fly whatever gets downloaded?