Selenium WebDriver unable to handle multiple file uploads in a React application on Chrome 120
I'm collaborating on a project where I'm upgrading from an older version and I'm prototyping a solution and I'm upgrading from an older version and I've been struggling with this for a few days now and could really use some help... I'm facing an issue with Selenium WebDriver where it fails to handle multiple file uploads in a React-based application when running on Chrome 120. The application uses a custom file input component that is supposed to accept multiple files, but when I try to automate the upload process, only the first file gets uploaded. Hereβs the relevant part of my Selenium code: ```python from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys import time # Set up the driver options = webdriver.ChromeOptions() options.add_argument('--headless') # Run in headless mode driver = webdriver.Chrome(options=options) # Navigate to the application driver.get('https://example.com/upload') # Locate the file input element file_input = driver.find_element(By.CSS_SELECTOR, 'input[type="file"]') # Attempting to upload multiple files file_input.send_keys('/path/to/file1.txt /path/to/file2.txt /path/to/file3.txt') # Submit the form submit_button = driver.find_element(By.CSS_SELECTOR, 'button[type="submit"]') submit_button.click() # Wait for the upload process to complete time.sleep(5) # Checking if files are uploaded uploaded_files = driver.find_elements(By.CSS_SELECTOR, '.uploaded-files') print([file.text for file in uploaded_files]) # Clean up driver.quit() ``` Despite sending multiple file paths, the application only registers the first file being uploaded, and I get the following error in the console: `Error: Invalid file type for file upload` if I try to upload any other type aside from the first one. I tried various ways to format the paths, including using commas and semicolons as separators, but nothing seems to work. I also checked the web application code and confirmed that the input accepts multiple files, as it has the `multiple` attribute. This issue occurs specifically on Chrome 120; it worked fine in earlier versions. Any insights on how to properly handle multiple file uploads with Selenium in this context would be greatly appreciated! This is part of a larger service I'm building. Any help would be greatly appreciated! This is for a mobile app running on Linux. I'm coming from a different tech stack and learning Python. Any pointers in the right direction? This issue appeared after updating to Python 3.9. I'd be grateful for any help.