Hello,
I’m new to KR and have no real experience in coding so I need some help. I’d even pay someone if there is interest.
The Problem: I’ve created a script in KR automate the process of creating a member account using data from a CSV file. It successfully goes through the process, but I’d like to have it loop through the process again using the next row of data from the CSV file until the end of the file.
Side Note: I tried to do this in KS, but I would have to have the script log into the account each time and enter a second security password which would get flagged. By using KR it keeps me logged in when I run the script each time.
Attached is a video, the code and the CSV file.
CSVSample.csv (325 Bytes)
NewMemberCSV.groovy (1.6 KB)
Maybe this thread might help:
You will need to use the commands while...endWhile
Can I suggest that you look at the sample scripts that can be downloaded from here
Thanks, I tried to add while…endWhile to my script but it stalled on the storeEval command. I’m not sure where the error lies.
Instead of “store” for your initialization of ii , maybe you should use, “storeEval”
command | target | value
storeEval | 1 | ii
Katalon Automation Recorder - Tips and tricks
Not everything is covered in documentation and command reference so i create this topic to share with you some things i found useful. Feel free to add yours tips and tricks here as well.
“alert();” in addScript don’t work, you need to use “originalAlert();”
Link where I found this: runScript as a replacement for storeEval
If you use runScript you have to click “ok” on alert 2 times. Be aware that Katalon will wait until you click “ok” on alert. …
Item #2 (first part for storing a Number , not a String )
No luck with “storeEval”. Still stalls on the row 67: StoreEval | ${ii}+1| ii
From Log:
Code:
@duyluong Can you assist?
@joetaberna You’re missing endLoadVars, without this, it won’t loop.
guy.mason:
endLoadVars
Thanks for the reply. That appears to be the issue, but I’m still having trouble getting it to loop through and create multiple accounts. Its stops once it gets to the “Save New Member” step.
Attached is a video, the script and the CSV file.
CSVSample.csv (208 Bytes)
Maybe check the Variables tab, seems like an issue with the while/endWhile loop. Didn’t see the inclusion of endLoadVars in your video, but then again, it’s just a video and not an actual copy of the script either.
/* Katalon Studio does not support: loadVars */
int ii = 1
while (ii<5) {
selenium.open("https://data.XXX.com/")
selenium.click("link=Members")
selenium.click("link=New Member")
selenium.selectFrame("index=0")
selenium.click("xpath=//form[@id='aspnetForm']/div[4]/div/table/tbody/tr/td[2]/div/button/span")
selenium.click("link=Individual")
selenium.click("xpath=//form[@id='aspnetForm']/div[4]/div/table/tbody/tr[2]/td[2]/div/button/span")
selenium.click("link=Athlete")
selenium.click("id=ctl00_MainContent_txtFirstName")
selenium.type("id=ctl00_MainContent_txtFirstName", (FirstName).toString())
selenium.click("id=ctl00_MainContent_txtLastName")
selenium.type("name=ctl00$MainContent$txtLastName", (LastName).toString())
selenium.click("xpath=//form[@id='aspnetForm']/div[4]/div/table/tbody/tr[4]/td[2]/div/button/span")
selenium.click("link=Male")
selenium.click("id=ctl00_MainContent_txtDOB")
selenium.type("id=ctl00_MainContent_txtDOB", (DOB).toString())
selenium.click("xpath=//form[@id='aspnetForm']/div[4]/div/table/tbody/tr[6]/td[2]/div/button/span")
selenium.click("xpath=//form[@id='aspnetForm']/div[4]/div/table/tbody/tr[6]/td[2]/div/div/ul/li[6]/a/span")
selenium.click("xpath=//table[@id='ctl00_MainContent_lstLevel']/tbody/tr/td[2]")
selenium.click("id=ctl00_MainContent_lstLevel_1")
selenium.click("id=ctl00_MainContent_txtCity")
selenium.type("id=ctl00_MainContent_txtCity", (City).toString())
selenium.click("id=ctl00_MainContent_txtState")
selenium.type("id=ctl00_MainContent_txtState", ("${State}").toString())
selenium.click("id=ctl00_MainContent_txtCountry")
/* selenium.Type("id=ctl00_MainContent_txtCountry", "${Country}") */
selenium.click("link=Save New Member")
selenium.waitForPageToLoad("30000")
ii = selenium.getEval(" var ii = \"" + ii + "\";var storedVars = { 'ii': ii }; " + ii + "+1").toInteger()
}
/* Katalon Studio does not support: endLoadVars */
/* selenium.() */
How can I find someone who can help me solve this issue? Is the a place where I can hire a Katalon expert?
You can try submitting a ticket to Customer Support . You would need to have a Katalon Studio Enterprise account to access the support service.
1 Like