-1

I have been writing the script to fill a form using Selenium with Python. I would like to attach an image file to it. So when I reach the button to upload the file and click it, I no longer can use Selenium to find the element.

I need to figure out how to enter the path to the image file, select it and upload it.

Please look at the image below to get a clear picture of what I am trying to do and let me know the solution.

enter image description here

1

1 Answer 1

2

You can even try directly with send_keys function on Browse button that us used to select file. It doesn't involves any windows popup handling.

Example:

import os


driver.find_element_by_id("#button_id").send_keys(os.getcwd() + "/image.png")
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.