I have tried to create a nested loop to acquire the data from a website. As I have shown below, due to the problem with nested loops, I have used normal coding instead of nested one. Can anyone help me with the corresponding nested version. PS: I don’t have commands like endwhile…, whilev1_depreceated… and many more , please can you explain how to solve this issue as well?
Here is the simple code I have used instead of two nested loops:
{
"CreationDate": "2021-5-25",
"Commands": [
{
"Command": "open",
"Target": "http://www.nepalstock.com.np/main/floorsheet/index/${!loop}/",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "1",
"Value": "nepse",
"Description": ""
},
{
"Command": "while_v2",
"Target": "(${nepse} <= 20)",
"Value": "",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[3]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[3]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[3]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[3]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[3]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[3]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[4]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[4]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[4]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[4]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[4]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[4]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[5]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[5]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[5]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[5]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[5]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[5]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[6]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[6]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[6]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[6]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[6]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[6]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[7]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[7]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[7]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[7]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[7]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[7]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[8]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[8]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[8]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[8]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[8]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[8]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[9]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[9]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[9]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[9]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[9]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[9]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[10]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[10]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[10]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[10]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[10]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[10]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[11]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[11]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[11]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[11]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[11]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[11]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[12]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[12]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[12]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[12]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[12]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[12]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[13]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[13]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[13]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[13]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[13]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[13]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[14]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[14]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[14]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[14]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[14]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[14]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[15]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[15]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[15]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[15]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[15]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[15]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[16]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[16]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[16]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[16]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[16]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[16]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[17]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[17]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[17]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[17]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[17]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[17]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[18]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[18]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[18]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[18]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[18]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[18]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[19]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[19]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[19]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[19]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[19]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[19]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[20]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[20]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[20]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[20]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[20]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[20]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[21]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[21]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[21]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[21]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[21]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[21]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[22]/td[3]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[22]/td[4]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[22]/td[5]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[22]/td[6]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[22]/td[7]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"home-contents\"]/table/tbody/tr[22]/td[8]",
"Value": "!csvLine",
"Description": ""
},
{
"Command": "csvSave",
"Target": "nepsedata",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "${nepse}+1",
"Value": "nepse",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
}
]
}
As you can see I have to store text from tr[3-22] and td[3-8] within each tr mentioned above. Furthermore, I will loop the code for thousand of times to collect data from the multiple pages available at the website mentioned i.e.http://www.nepalstock.com.np/main/floorsheet/index/${!loop}/ . Also suggest solutions (if there are any) to change the default results from 20 to 500.