# Unable to upload a file using window pop up(file explorer)

**URL:** <https://forum.katalon.com/t/unable-to-upload-a-file-using-window-pop-up-file-explorer/10387>\
**Category:** Miscellaneous\
**Tags:** web-testing, katalon-studio\
**Created:** [April 19, 2018, 7:24am UTC](https://forum.katalon.com/t/unable-to-upload-a-file-using-window-pop-up-file-explorer/10387 "2018-04-19T07:24:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sirisha\_kasireddy](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@sirisha\_kasireddy](https://forum.katalon.com/u/sirisha_kasireddy)\
**Post date:** [April 19, 2018, 7:24am UTC](https://forum.katalon.com/t/unable-to-upload-a-file-using-window-pop-up-file-explorer/10387/1 "2018-04-19T07:24:22Z")

</div>

Using both Katalon Studio and IDE recorder  
1. Navigate to URL  
2. Click on Upload Button  
3. Windows popup opens  
4. Unable to select the file and click on OPEN on popup

---

<div class="post-metadata">

**Author:** ![emine](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/emine/32/15639_2.png) [@emine](https://forum.katalon.com/u/emine)\
**Post date:** [February 7, 2019, 10:46am UTC](https://forum.katalon.com/t/unable-to-upload-a-file-using-window-pop-up-file-explorer/10387/2 "2019-02-07T10:46:59Z")

</div>

Hello ,  
You can follow these steps for this situation.  
1-You must create a new custom keyword. You can access the link below for new add Custom Keyword .  
[https://docs.katalon.com/katalon-studio/tutorials/create\_custom\_keyword.html](https://docs.katalon.com/katalon-studio/tutorials/create_custom_keyword.html)

2-You must add the following snippet in Keyword.  
import com.kms.katalon.core.annotation.Keyword  
import com.kms.katalon.core.testobject.TestObject  
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI  
import internal.GlobalVariable

public class testclass {

```auto
@Keyword
def uploadFile (TestObject to, String filePath) {
	WebUI.click(to)
	StringSelection ss = new StringSelection(filePath);
	Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
	Robot robot = new Robot();
	robot.keyPress(KeyEvent.VK_ENTER);
	robot.keyRelease(KeyEvent.VK_ENTER);
	robot.keyPress(KeyEvent.VK_CONTROL);
	robot.keyPress(KeyEvent.VK_V);
	robot.keyRelease(KeyEvent.VK_V);
	robot.keyRelease(KeyEvent.VK_CONTROL);
	robot.keyPress(KeyEvent.VK_ENTER);
	robot.keyRelease(KeyEvent.VK_ENTER);
}

```

}

3-Finally, you should call keyword u in the corresponding step.  
After the keyword is included in the project, the relevant test case step in the script field should be as follows.  
CustomKeywords.‘test.testclass.uploadFile’(findTestObject(‘Test\_uploadfile\_field’), 'C:\Users\Desktop\test data)

Hopefully it is helpful.
