Upload Image Using Selenium

Viewed 44

I am not able to upload an image using pythons Selenium:

driver.find_element_by_xpath('//*[@id="uploadButton"]').send_keys("image_path")

enter image description here

enter image description here

An this:

enter image description here

1 Answers

To upload file with Selenium like you trying to do you should use //input[@type="file"] element.
So please try this, it should work:

driver.find_element_by_xpath('//input[@type="file"]').send_keys("image_path")
Related