I am currently working on a project that requires the upload of two specific files on a web page (a PDF file and an ODT file.
But, it works only for ONE file (which is the first one defined in the ‘full_path’ variable) when I try to upload these files using this code:
# Defining the PDF file path
PDF_path = "C:\Users\my\folder\PDF\my_file.pdf"
PDF_path = os.path.abspath(PDF_path)
# Defining the ODT file path
ODT_path = "C:\Users\my\folder\PDF\my_file.odt"
ODT_path = os.path.abspath(ODT_path)
# Defining the 'full path'
full_path = PDF_path + "n" + ODT_path
# Uploading both files
driver.find_element(By.CSS_SELECTOR, 'input[type="file"]').send_keys(str(full_path));
I also tried uploading these files one by one, even by waiting between the upload of the first one and the second one. But when I do this, the second upload is the first file that has been duplicated.
I really need some help.
Thanks in advance for the ones who will answer this topic !
Kamil27 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.