Check a box based on value in Excel *help!*

Hi, I’m trying without knowing too much about choosing check status from excel.
I have my spreadsheet with my column in true or false and my code is as follows:

if (true) {
WebUI.check(findTestObject(‘cargaMasiva/Page_Registrar Horas/Prueba ddl CM/Page_Registrar Horas/Page_Registrar Horas/Page_Registrar Horas/Page_Registrar Horas/Check_F’))
} else {
WebUI.uncheck(findTestObject(null))
}

What should I correct?

in the tests it does not give me an error but it does not uncheck the box either

An if statement usually has a boolean condition within the parenthesis, like:

if (hasChoice == true) { blah blah blah

or even

if (hasChoice) { blah blah blah

But if you really have your “condition” statement as, if (true) {, then you really don’t need an if statement as there will never be a time for a false to occur.

Another concern is, WebUI.uncheck(findTestObject(**null**)). this will never work. You need a name (or even a pathway) for your test object. Fix this.

Also, do you really have the same folder name 4 times or is this a copy and paste error.

findTestObject('cargaMasiva/Page_Registrar Horas/Prueba ddl CM/Page_Registrar Horas/Page_Registrar Horas/Page_Registrar Horas/Page_Registrar Horas/Check_F')

Otherwise, we need more information on your “choosing check status from excel”, like:

if (findTestData(...) == "true") {    // notice I am testing against String true and not Boolean true
    WebUI.check(findTestObject('cargaMasiva/.../Check_F'))
} else {
    WebUI.uncheck(findTestObject('yourTestObjectToUncheck'))
}
1 Like

I ve checked some errors like IF and NULL and it worked!

thank you so much!!!