Upload

to upload a file, just make sure the attribute type="file" is in the upload button or field.

then you would just send keys normally to that particular element.

demo site: https://demo.automationtesting.in/FileUpload.html

browse_button = driver.find_element(By.ID, "input-4")
browse_button.send_keys("path of the file you want to upload/testfile.txt")
Updated on