Reputation: 639
I'm using python and selenium chrome driver to click on an upload file button which opens an open file window as shown:
My code uploads the files without interacting with the window. What I'm trying to do is close this window but am not sure how to go about doing this.
I've read various other posts with the similar problem but none I could find really gave me what I was looking for. I understand selenium can't access the window, and I've read I need a different module to interact with it. What would be the best way to do this?
Upvotes: 2
Views: 3243
Reputation: 639
In the end I was able to upload the item directly into the page by finding the upload button and sending it the file path.
driver.find_element_by_xpath("//*[@id='upl-fileInp']").send_keys("C:/Users/user/folder/file.jpg")
Upvotes: 1
Reputation: 1706
Workaround
You need put inside element of upload the root file. Don't open the upload by button, just insert /root/of/file/file.pdf
inside input upload value using Javascript. Remember, that's my workaround... haha
Upvotes: 0