I'm setting up a automatisation of a upload process of a website and I am struggeling right now with uploading a picture.
Normally you would use
uploadBtn.send_keys(Path)
, but the image would just not upload. I have also been trying to implement some Javascript, so I added an attribute "type=file"
My Python code:
uploadInput = driver.find_element_by_xpath("//a[contains(.,\"Browse\")]")#
jsSetAttributeFileInput = "arguments[0].setAttribute(\"type\",\"file\")"
driver.execute_script(jsSetAttributeFileInput, uploadInput)
uploadInput.send_keys(design["DesignPath"])
The HTML of the Website:
<a href="javascript:void(0)"> Browse </a>
I expect the result to upload my picture, but it just does not upload it. I don't get any errors, but it's just not uploading. I think it has something to do with the HTML, because it is an 'a'-tag instead of an 'input'-tag