You need to set !statusOK to true after the inner while loop since the outer while loop uses the same condition and !statusOK doesn’t reset itself, once it’s false it’ll remain that way until you change it. In general, I’d recommend setting !statusOK to true before every verify/assert/waitfor command so that it’s never accidentally executed with !statusOK as false to begin with.
Try this (note that I didn’t put a verifyelement in the inner loop because storetext will serve the same purpose there, otherwise you’d need one):
{
"Name": "TEMPORARY-4",
"CreationDate": "2022-8-19",
"Commands": [
{
"Command": "store",
"Target": "true",
"Value": "!errorignore",
"Description": ""
},
{
"Command": "store",
"Target": "4",
"Value": "q",
"Description": ""
},
{
"Command": "store",
"Target": "true",
"Value": "!statusOK",
"Description": ""
},
{
"Command": "verifyElementPresent",
"Target": "//*[@id=\"app\"]/div/div[4]/div/section/div[2]/div/div[2]/div[1]/div/div/div[3]/div[3]/nav/ul/li[${q}]",
"Value": "",
"Description": ""
},
{
"Command": "while_v2",
"Target": "${!statusOK}",
"Value": "",
"Description": ""
},
{
"Command": "XClick",
"Target": "//*[@id=\"app\"]/div/div[4]/div/section/div[2]/div/div[2]/div[1]/div/div/div[3]/div[3]/nav/ul/li[${q}]",
"Value": "",
"Description": ""
},
{
"Command": "executeScript_Sandbox",
"Target": "return Number (${q}) + 1",
"Value": "q",
"Description": ""
},
{
"Command": "comment",
"Target": "START LIST (not page) LOOP",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "1",
"Value": "i",
"Description": ""
},
{
"Command": "store",
"Target": "true",
"Value": "!statusOK",
"Description": ""
},
{
"Command": "verifyElementPresent",
"Target": "//*[@id=\"app\"]/div/div[4]/div/section/div[2]/div/div[2]/div[1]/div/div/div[2]/div[${i}]/article/div[3]/div[1]/div/div[1]/div/div[1]/div/div/div[2]/span/a",
"Value": "",
"Description": ""
},
{
"Command": "while_v2",
"Target": "${!statusOK}",
"Value": "",
"Description": "list of company names"
},
{
"Command": "storeText",
"Target": "//*[@id=\"app\"]/div/div[4]/div/section/div[2]/div/div[2]/div[1]/div/div/div[2]/div[${i}]/article/div[3]/div[1]/div/div[1]/div/div[1]/div/div/div[2]/span/a",
"Value": "!csvline",
"Description": ""
},
{
"Command": "if_v2",
"Target": "${!statusOK}",
"Value": "",
"Description": ""
},
{
"Command": "csvSave",
"Target": "aaa_companynames3",
"Value": "",
"Description": ""
},
{
"Command": "executeScript_Sandbox",
"Target": "return Number (${i}) + 1",
"Value": "i",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "comment",
"Target": "END LIST (not page) LOOP",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "true",
"Value": "!statusOK",
"Description": ""
},
{
"Command": "verifyElementPresent",
"Target": "//*[@id=\"app\"]/div/div[4]/div/section/div[2]/div/div[2]/div[1]/div/div/div[3]/div[3]/nav/ul/li[${q}]",
"Value": "",
"Description": ""
},
{
"Command": "comment",
"Target": "above to make status ok for big page loop",
"Value": "",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
}
]
}