Home > Net >  Upload Image Using Selenium
Upload Image Using Selenium

Time:01-13

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

CodePudding user response:

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")
  •  Tags:  
  • Related