Answer the question
In order to leave comments, you need to log in
Selenium + python + chromedriver - multiple file upload. How?
Good afternoon. I am writing a test in Python using selenium and chromedriver. It will run on Linux, but I'm writing on MacOS. There was a problem uploading multiple files.
There is a button that opens a dialog for selecting files (any number) and after pressing the OK button, the download automatically starts. So here's how to do it from code?
Here is the button...
Here is my code, how I tried to do it, and it does not work (First I wanted to substitute at least one file). After opening the file selection dialog, nothing happens..
print('upload...')
WebDriverWait(self.driver,10).until(ec.presence_of_element_located((By.CLASS_NAME,'action-multiple-upload-button')))
uploadButton = self.driver.find_element_by_class_name('action-multiple-upload-button')
uploadButton.click()
time.sleep(5)
print(os.getcwd()+"/image.png")
Answer the question
In order to leave comments, you need to log in
I don't see in the code that you have selected a file. You waited for the element to appear, found the button, clicked, fell asleep, and printed out the text. what did you expect then?
I haven't tried it, but maybe the SendKey('AbsolutePathToFile') chain will help.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question