How can I set a text to every text box?

Normally, with OPTIONAL, there are errors in the logs, but in the form of a warning. This is normal, and the test is (normally) successful.

Because you find all “tr” elements

Try something like

List<WebElement> tr_withInput = Table.findElements(By.xpath('//tr[*//input[contains(@id, 'vRESULTADOVALOR_')]]'))

(edit : or input directly)
and loop on this list as @Russ_Thomas suggested

1 Like

Hi, once again
I took all of the tips and help you gave me and made the next piece of code:

WebDriver driver = DriverFactory.getWebDriver()
WebElement Table = driver.findElement(By.id('Grid1ContainerDiv'))
//List<WebElement> Rows = Table.findElements(By.tagName('tr'))
List<WebElement> tr_withInput = Table.findElements(By.xpath('//tr[*//input[contains(@id, \'vRESULTADOVALOR_\')]]'))
println(tr_withInput.size())
table: for (int i = 1; i < tr_withInput.size(); i++) {
	println("hola " + i)
	TestObject toV = new TestObject()
	String objectXpathV = CustomKeywords.'keywordPrueba.CustomFunction.getDynamicObjects'("//input[@id='vRESULTADOVALOR_",i)
	toV.addProperty('xpath', ConditionType.EQUALS, objectXpathV)
	WebUI.scrollToElement(toV, 5)
	if(WebUI.verifyElementNotPresent(toV, 5, FailureHandling.OPTIONAL)){
		table: break
		}else{
		WebElement elementPrueba = WebUiCommonHelper.findWebElement(toV, 5)
		String textInsideInputBox = elementPrueba.getAttribute("value");
		if(textInsideInputBox.isEmpty()){
			CustomKeywords.'keywordPrueba.CustomFunction.clickUsingJS'(toV,5)
			WebUI.executeJavaScript('arguments[0].value=\'12\'', Arrays.asList(elementPrueba))
			}
		}
	}

This was working fine until today. Now, Katalon throws the same error as before. I am struggling to know why so if you have any suggestions or helpful answer I would appreciate it.

Please post the error. ALL OF IT.

The hard part of this is the number of moving parts:

  1. A clear statement of intent (the code has changed so much since the start of the topic I have no clear idea of what is going on).
  2. The custom keyword - post it again.
  3. You. Does the following look like a logical series of steps to you?

If you can’t see the logical discrepancy there, then might I suggest you learn the basics of programming first before you expect to write code that tests the code and outcomes of other people’s work?

Also, every copy of your custom keyword appears to return null (void object) since the println seems to be the last thing evaluated. Unless there’s more code that you haven’t shown us?

1 Like

Thanks for the response
The problem is now solved