Hire QA – Specialized in QA Recruitment, Technical Interviews and Testing Solutions

How do you upload a file using Selenium WebDriver?

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")

Leave a Reply

Your email address will not be published. Required fields are marked *