Sean
Sean

Reputation: 79

Python Selenium Selecting Files from File System

I'm trying to select files from the file system to add to the field which is not a form field, I tried using "send_keys" but didn't work.

Also, is there any way to handle os pop up's like "renaming a file in the download dialog box before saving it"?

Here's the link, please have a look: https://pdfcandy.com/jpg-to-pdf.html

enter image description here

Upvotes: 0

Views: 665

Answers (1)

PDHide
PDHide

Reputation: 19939

element = driver.find_element_by_css_selector('input[type="file"]')


element.send_keys(r"<path>\testupload.jpg")

It already has input elemnt

Upvotes: 1

Related Questions