Totally new to Katalon.
I’m using a custom Keyword in Katalon to upload a file to my owncloud server.
public class WebUICustomKeyword {
@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);
}
}
When calling it in a for-loop just the first iteration is successful. The other stop at uploading in the explorer. (debian 9 stretch)
Surprisingly when calling the keyword twice in a row everything works fine:
CustomKeywords.'aCustom.WebUICustomKeyword.uploadFile'(findTestObject('Object Repository/Page_Files - ownCloud/label_Upload'), '/home/timo/Downloads/Ba_MyDigital_School.pdf')
CustomKeywords.'aCustom.WebUICustomKeyword.uploadFile'(findTestObject('Object Repository/Page_Files - ownCloud/label_Upload'), '/home/timo/Downloads/Ba_MyDigital_School.pdf')
WebUI.click(findTestObject('Page_Files - ownCloud/label_New_Files'))
WebUI.click(findTestObject('Object Repository/Page_Files - ownCloud/button_Continue'))
Any ideas why?