# Locate a "frame" to upload file

**URL:** <https://forum.robotframework.org/t/locate-a-frame-to-upload-file/4017>\
**Category:** Browser\
**Created:** [18 June 2022 18:29 UTC](https://forum.robotframework.org/t/locate-a-frame-to-upload-file/4017 "2022-06-18T18:29:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Piotr](https://avatars.discourse-cdn.com/v4/letter/p/839c29/32.png) [@Piotr](https://forum.robotframework.org/u/Piotr)\
**Post date:** [18 June 2022 18:29 UTC](https://forum.robotframework.org/t/locate-a-frame-to-upload-file/4017/1 "2022-06-18T18:29:50Z")

</div>

Hi,

 ![Upload file](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/3/3931585ac0cb5d6b588b23388c687c435f2d27f6.png)

On selected screen you can find “attach logo” button which I selecting.  
then is “windows” where I need to select file.  
Unfortunately I can not find way to locate “File Name:” box to input path.

I have no idea how to find this new frame as it is not displayed in code. I’m using browser library and know which keyword to use, even tried to do that with python-playwright.  
Still do not know how to find the way to locate this window.

Someone can help ?

Regard  
Piotr

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [19 June 2022 21:52 UTC](https://forum.robotframework.org/t/locate-a-frame-to-upload-file/4017/2 "2022-06-19T21:52:18Z")

</div>

Hi Piotr,

You will need to dig around the form in the html to find the file input field, it looks like it’s a hidden field. I would guess that it’s somewhere between the button and the image preview but it may also be between the contact info field and the button too.

There is a possibility that there is no file field and it’s being uploaded with pure javascript (this is rare but I have seen it), if this is the case you’ll need to find callback the function that is called when a file is selected and use [Execute JavaScript](https://marketsquare.github.io/robotframework-browser/Browser.html#Execute%20JavaScript)

If you are having trouble finding the file input field ask your dev team where it is, they should be able to show you (or if it’s a publicly available site we could have a look for you)

Dave.

---

<div class="post-metadata">

**Author:** ![rasjani](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@rasjani](https://forum.robotframework.org/u/rasjani)\
**Post date:** [21 June 2022 07:57 UTC](https://forum.robotframework.org/t/locate-a-frame-to-upload-file/4017/3 "2022-06-21T07:57:32Z")

</div>

Screenshot looks like its not a browser window but a native file selector dialog. I have not used playwright or browser library but i doubt that neither has support for interacting with “native” UI’s so, something like AutoIT or other windows speciic tools are required.

If your web app accepts “dragging and dropping” the file into the page itself, SeleniumTestability does have some code to handle this sort of case in “pure javascript”, however, since its intended for selenium specifically, you might need to adapt the code:

- [robotframework-seleniumtestability/plugin.py at master · MarketSquare/robotframework-seleniumtestability · GitHub](https://github.com/MarketSquare/robotframework-seleniumtestability/blob/master/src/SeleniumTestability/plugin.py#L535=)
- [robotframework-seleniumtestability/javascript.py at master · MarketSquare/robotframework-seleniumtestability · GitHub](https://github.com/MarketSquare/robotframework-seleniumtestability/blob/master/src/SeleniumTestability/javascript.py#L70=)

---

<div class="post-metadata">

**Author:** ![mkorpela](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/mkorpela/32/33_2.png) [@mkorpela](https://forum.robotframework.org/u/mkorpela)\
**Post date:** [18 July 2022 15:43 UTC](https://forum.robotframework.org/t/locate-a-frame-to-upload-file/4017/4 "2022-07-18T15:43:05Z")

</div>

You might use [https://marketsquare.github.io/robotframework-browser/Browser.html#Upload%20File%20By%20Selector](https://marketsquare.github.io/robotframework-browser/Browser.html#Upload%20File%20By%20Selector)

To bypass the native dialog

---

<div class="post-metadata">

**Author:** ![Piotr](https://avatars.discourse-cdn.com/v4/letter/p/839c29/32.png) [@Piotr](https://forum.robotframework.org/u/Piotr)\
**Post date:** [20 July 2022 09:11 UTC](https://forum.robotframework.org/t/locate-a-frame-to-upload-file/4017/5 "2022-07-20T09:11:15Z")

</div>

I was trying this from very begging but all the time I’m getting “waiting for selector”  
Probably problem is here but I have not idea how to create proper one selector.  
Maybe you can help.  
Here is Screen from AutoIT with I believe all necessary information to do that

 ![AutoIT](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/9/995164d6e4cc8133324a2b9e3ae8e5f2c872a349.png)  
I move mouse to show information from place were normally you can type name of file

---

<div class="post-metadata">

**Author:** ![mkorpela](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/mkorpela/32/33_2.png) [@mkorpela](https://forum.robotframework.org/u/mkorpela)\
**Post date:** [20 July 2022 14:00 UTC](https://forum.robotframework.org/t/locate-a-frame-to-upload-file/4017/6 "2022-07-20T14:00:42Z")

</div>

The upload method will never open the native dialog. Instead it will response to the web page with the selected file.

You need to target with the selector the input element with the type file on the web page.

> **[\- HTML: HyperText Markup Language | MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file)**
>
> elements with type="file" let the user choose one or more files from their device storage. Once chosen, the files can be uploaded to a server using form submission, or manipulated using JavaScript code and the File API.
