If condition not working within while

My code checks how many rows there are in the table and then puts this into the ‘row’ variable.

Once it can’t see any more rows using a multiple of 10 it then tracks back -1 until it finds the total. The total number of rows is then put in a while command so that it will stop on the last row.

Unfortunately, the column I need information from in each row changes depending on the row, due to a colour coding system which can add another column at the beginning. So my code will check if column 11 exists on that row, if not store text in column 8, if it does column 9.

Strangely, this part does not work. Despite seeing from the log that the code does work in identifying the element as not present, or times out in not confirming its absence, they both seem to store text of column 9.

My code works when I start it from after the finding the number of rows process and put in a command saying store 8 in the ‘rows’ variable. Is it something about that first part that is messing up the latter?

Thanks in advance for any help.

Code below:

{

  "Command": "open",

  "Target": *name of website*,

  "Value": "",

  "Description": ""

},

{

  "Command": "store",

  "Target": "0",

  "Value": "row",

  "Description": ""

},

{

  "Command": "do",

  "Target": "",

  "Value": "",

  "Description": ""

},

{

  "Command": "executeScript_Sandbox",

  "Target": "return Number (${row}) + 10;",

  "Value": "row",

  "Description": ""

},

{

  "Command": "verifyElementPresent",

  "Target": "xpath=//*[@id=\"featured-datatable\"]/tbody/tr[${row}]/td[8]",

  "Value": "",

  "Description": ""

},

{

  "Command": "repeatIf",

  "Target": "${!statusOK}",

  "Value": "",

  "Description": ""

},

{

  "Command": "do",

  "Target": "",

  "Value": "",

  "Description": ""

},

{

  "Command": "executeScript_Sandbox",

  "Target": "return Number (${row}) - 1;",

  "Value": "row",

  "Description": ""

},

{

  "Command": "verifyElementPresent",

  "Target": "xpath=//*[@id=\"featured-datatable\"]/tbody/tr[${row}]/td[8]",

  "Value": "",

  "Description": ""

},

{

  "Command": "repeatIf",

  "Target": "${!statusOK}",

  "Value": "",

  "Description": ""

},

{

  "Command": "store",

  "Target": "1",

  "Value": "i",

  "Description": ""

},

{

  "Command": "while",

  "Target": "${i} < ${row}",

  "Value": "",

  "Description": ""

},

{

  "Command": "verifyElementNotPresent",

  "Target": "xpath=//*[@id=\"featured-datatable\"]/tbody/tr[${i}]/td[11]",

  "Value": "",

  "Description": ""

},

{

  "Command": "if",

  "Target": "${!statusOK}",

  "Value": "",

  "Description": ""

},

{

  "Command": "storeText",

  "Target": "xpath=//*[@id=\"featured-datatable\"]/tbody/tr[${i}]/td[8]",

  "Value": "natevent",

  "Description": ""

},

{

  "Command": "store",

  "Target": "${natevent}",

  "Value": "!csvLine",

  "Description": ""

},

{

  "Command": "else",

  "Target": "",

  "Value": "",

  "Description": ""

},

{

  "Command": "storeText",

  "Target": "xpath=//*[@id=\"featured-datatable\"]/tbody/tr[${i}]/td[9]",

  "Value": "natevent",

  "Description": ""

},

{

  "Command": "store",

  "Target": "${natevent}",

  "Value": "!csvLine",

  "Description": ""

},

{

  "Command": "end",

  "Target": "",

  "Value": "",

  "Description": ""

},

{

  "Command": "echo",

  "Target": "${natevent}",

  "Value": "",

  "Description": ""

},

{

  "Command": "executeScript_Sandbox",

  "Target": "return Number (${i}) + 1;",

  "Value": "i",

  "Description": ""

},

{

  "Command": "end",

  "Target": "",

  "Value": "",

  "Description": ""

},

{

  "Command": "csvSave",

  "Target": "natevents.csv",

  "Value": "",

  "Description": ""

},

{

  "Command": "storeText",

  "Target": "xpath=//*[@id=\"featured-datatable\"]/tbody/tr[2]/td[10]",

  "Value": "",

  "Description": ""

}

]

}

  1. You you should assign integer value to row variable by using.

executescript_sandbox | return parseInt(0) | row

  1. you should also decrease this variable same method
    executescript_sandbox | return parseInt(${row})-1 | row

  2. You check variable states in variable section.
    if you facing this problem just embed website url of table.