Python -> Selenium : Not able to upload the file
I was able to figure out the issue. Below the input field accepts "jpeg and png" and I was trying to upload "jpg". Once I changed the input to "jpeg or png" it worked.
Code:
<input type="file" accept="image/png, image/jpeg" style="display: none;">
What I was doing :
upload.send_keys('/Users/username/Desktop/images/filename.jpg')
Solution : Change the file extension to jpeg or png.
upload.send_keys('/Users/username/Desktop/images/filename.jpeg')
Code:
<input type="file" accept="image/png, image/jpeg" style="display: none;">
What I am trying to do:
upload = driver.find_elements_by_xpath("//input[@type = 'file']")
upload.send_keys('/Users/username/Desktop/images/filename.jpg')
PS : This code is not in any iframe and element can be found (I checked its attribute to be sure)
Nothing happens, I have written the same logic to upload files in other test cases and it worked.
Thanks for your help!