Hello all,
I have just started using katalon Studio and been testing around to set things up.
I made a script with a popup, that popup should take the usersinput and run a loop for that many times, this is to run a test to create new products to test.
But the problem is, dosent matter what i put in, it will go for infinite.
Anyone know what might be the problem? , code below.
KeywordLogger log = new KeywordLogger()
ArrayList ArtikelNrIckeIndividList = new ArrayList()
JFrame frame = new JFrame('IckedIndividArtiklar');
String PopUpIckeIndividArtiklar = JOptionPane.showInputDialog(
frame,
'Hur många IckeindividArtiklar vill du skapa?\n Använd heltal',
'IckedIndividArtiklar',
JOptionPane.WARNING_MESSAGE);
WebUI.openBrowser('http://Removed for security reason')
WebUI.maximizeWindow()
WebUI.setText(findTestObject('Removed for security reason'), 'Removed for security reason')
WebUI.setEncryptedText(findTestObject('ORemoved for security reason'), 'Removed for security reason')
WebUI.click(findTestObject('ORemoved for security reason'))
WebUI.click(findTestObject('Removed for security reason'))
WebUI.click(findTestObject('Removed for security reason'))
int PopUpIckeIndividArtiklar2 = String.valueOf(PopUpIckeIndividArtiklar);
Thread.sleep(1000)
for (int i = 0; i <= PopUpIckeIndividArtiklar2; i++) {
WebUI.click(findTestObject('Removed for security reason'))
WebUI.click(findTestObject('Removed for security reason'))
WebUI.click(findTestObject('Removed for security reason'))
WebUI.click(findTestObject('Removed for security reason'))
WebUI.click(findTestObject('Removed for security reason'))
WebUI.setText(findTestObject('Removed for security reason'),
'100')
WebUI.click(findTestObject('Removed for security reason'))
WebUI.click(findTestObject('Removed for security reason'))
data = (GlobalVariable.ArtikelNrIckeIndivid = WebUI.getText(findTestObject('Removed for security reason')))
ArtikelNrIckeIndividList.add(data)
WebUI.click(findTestObject('Removed for security reason'))
}
log.logInfo(ArtikelNrIckeIndividList)
WebUI.closeBrowser()
Edit:
Solved the error
I have to use: int PopUpIckeIndividArtiklar2 = Integer.valueOf(PopUpIckeIndividArtiklar)
isteed of: int PopUpIckeIndividArtiklar2 = String.valueOf(PopUpIckeIndividArtiklar);