Hello, i new in katalon studio, this is my skenario
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import org.openqa.selenium.By
import org.openqa.selenium.WebDriver as WebDriver
import org.openqa.selenium.WebElement
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
WebUI.openBrowser(’’)
String ExpectedValue = ‘31824174271065917763’
WebDriver driver = DriverFactory.getWebDriver()
WebElement Table = driver.findElement(By.xpath(’//[@id=“kt_content”]/div[2]/div/div[1]/div[2]/div[1]/table/tbody’))
List Rows = Table.findElements(By.tagName(‘tr’))
System.out.println(Rows.size())
table: for (int i = 0; i < Rows.size(); i++) {
println(Rows.get(i).getText())
List<WebElement> Cols = Rows.get(i).findElements(By.tagName('td'))
for (int j = 0; j < Cols.size(); j++) {
println (Cols.get(j).getText())
if (Cols.get(j).getText().equalsIgnoreCase(ExpectedValue)) {
Cols.get(5).findElement(By.tagName('a')).click()
break
}
}
}
And then this is error
java.lang.IndexOutOfBoundsException: Index: 5, Size: 5
at java_util_List$get$1.call(Unknown Source)
at Create Adjustment Reconcile.run(Create Adjustment Reconcile:50)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1600070359413.run(TempTestCase1600070359413.groovy:23)
this code can find my expected value (31824174271065917763) but can’t click button. Error in this code
Cols.get(5).findElement(By.tagName(‘a’)).click()
And this is my html code, i want to click
360001FE902542081916 36020200836000100 KREDIT ALREADY ADJUSTED **** Stockholm-icons / Communication / WriteCreated with Sketch.Please help me, thank you