Downloading file with Selenium using Github Action

Viewed 44

I have a Python script that uses Selenium to download a file. It works locally, but I'm hoping to use Github Actions to run the script. I believe the issue is with the download.default_directory. From my understanding, and testing locally, I have to specify a download directory when running Headless Chrome. I verified that this location is the working directory, however, when I try to read the file in using Pandas, it says the file doesn't exist. From running locally, I know the file name is static - data.xls. I'm using Windows to run the Github Action. I tried using Ubuntu, but was having the same issue locating the downloaded file. Is there a location that a downloaded file would go?

chromedriver_autoinstaller.install()
chrome_options = Options()

chrome_options.add_argument("--headless")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-dev-shm-usage")

chrome_prefs = {"download.default_directory": "D:\\a\\ariba\\ariba"}
chrome_options.experimental_options["prefs"] = chrome_prefs

driver = webdriver.Chrome(options=chrome_options)

....

data = pd.read_excel("D:\\a\\ariba\\ariba\\data.xls")
0 Answers
Related