Katalon Studio Native Popup Window and Upload File

hy emine,

i have make a test case as the tutorial above
my test case is upload three file from three button as continued,
it’s success for my first button, but in second button the file cannot be selected.
i have putted delay also

Would you help me to solve this problem?

With delay it worked for me well. Thank you so much

hy kowsalya,

i also put delay, but when in the second button when pop up for folder appear, it can’t choose the project folder

Thank you

Hi agnessiregar16,

I actually input full file path. (For example C:\test.txt) with the below code, it automatically selects the file and presses enter and the web application should have already the file uploaded.

@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.delay(1000)
           Thread.sleep(3000)
	robot.keyPress(KeyEvent.VK_ENTER);
	robot.keyRelease(KeyEvent.VK_ENTER);
	robot.autoDelay;
	robot.keyPress(KeyEvent.VK_CONTROL);
	robot.keyPress(KeyEvent.VK_V);
	robot.keyRelease(KeyEvent.VK_V);
	robot.keyRelease(KeyEvent.VK_CONTROL);
	robot.autoDelay;
	robot.keyPress(KeyEvent.VK_ENTER);
	robot.keyRelease(KeyEvent.VK_ENTER);
}

Robot framework sometime keeps the native window dialog open. This may be an issue in your case. Just make delay and use the custom keyword to upload the file three times in your testcsase. Add thread.sleep in your testcase in between file1 upload and file2 upload.

Hope this helps.