Category:
Selenium WebDriver
To upload a file we can simply use the command element.send_keys(file path). But there is a prerequisite before we upload the file. We have to use the html tag: ‘input’ and attribute type should be ‘file’.
element = driver.find_element_by_id(”uploaded_file")
element.send_keys("C:myfile.txt")