Element is not visible until a data set is correct

Need help, I have an object that does not appear in html until a data set is correct, the issue is that when I test with verifyElementNotPresent it gives me an error saying Unable to verify object ‘Object Repository / EntryChasisYmotorEmpadronamiento / Valor_Patente’ is not present.
Also, that when the element is already present in the html that leaves the iteration and enter value in the field that was not visible before.
attached code:

    boolean var= WebUI.verifyElementNotPresent(findTestObject('Object Repository/IngresoChasisYmotorEmpadronamiento/Valor_Patente'),10)
    if (var == true) {
    	for (def row = 1; row <= findTestData('ChasisYMotor').getRowNumbers(); row++) {
    		WebUI.setText(findTestObject('IngresoChasisYmotorEmpadronamiento/Nro.Chasis'), findTestData('ChasisYMotor').getValue(
    				'CHASIS', row))
    	
    		WebUI.setText(findTestObject('IngresoChasisYmotorEmpadronamiento/Nro.Motor'), findTestData('ChasisYMotor').getValue(
    				'MOTOR', row))
    	
    	WebUI.click(findTestObject('IngresoChasisYmotorEmpadronamiento/BotonBuscar'))
    	}
    	}
    else  (var==false) {
    			WebUI.setText(findTestObject('Object Repository/IngresoChasisYmotorEmpadronamiento/Valor_Patente'),
    		'20000')
    	}

Please try to post in English. Google translation:

Need help, I have an object that does not appear in html until a data set is correct, the issue is that when I test with verifyElementNotPresent it gives me an error saying Unable to verify object ‘Object Repository / EntryChasisYmotorEmpadronamiento / Valor_Patente’ is not present.
Also, that when the element is already present in the html that leaves the iteration and enter value in the field that was not visible before.

There is a problem with your code.

image

Try this construct:

boolean var= WebUI.verifyElementNotPresent(findTestObject('Object Repository/IngresoChasisYmotorEmpadronamiento/Valor_Patente'),10)
    if (var == true) {
     // same stuff
    } else {
      WebUI.setText(findTestObject('Object Rep...'))
    }

Edit your code to look like that, then let us know what’s happening.

Thanks for the correction in the part of the code, but the problem is in Boolean var = WebUI.verifyElementNotPresent (findTestObject (‘Object Repository / EntryChasisYmotorEmpadronamiento / Valor_Patiente’), 10), since validating that the element is not visible gives me the error in
-Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to verify object ‘Object Repository/IngresoChasisYmotorEmpadronamiento/Valor_Patente’ is not present
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:48)

I’m sorry, I don’t believe that’s true.

But you are not validating the element is not VISIBLE, you’re verifying the element is not PRESENT.

  1. Present: true if the element can be found in the DOM.
  2. Visible: true if the element can be found AND it is visible in the viewport (screen).

Plus, pay attention to the difference between:

  1. verifying something is present/visible
  2. waiting until something is present/visible

https://docs.katalon.com/katalon-studio/docs/webui-wait-for-element-present.html
https://docs.katalon.com/katalon-studio/docs/webui-wait-for-element-visible.html

Or, in your case, this maybe:

https://docs.katalon.com/katalon-studio/docs/webui-wait-for-element-not-present.html

hi,
boolean condition

if (var) --> executed if var=true
if (!var) --> executed if var=false