Hoping you could help me make a nested loop work with iMacros.
- First loop: Loops all rows of source.csv (col A, multiple rows)
- Second loop (X): Grab all the List elements found on hxxp://site.com/?what={{!COL1}}
After a lot of work I feel I am finally getting somewhere:
The problem in the script is that I cannot get Loop {{n}} to grab all the positions of the page (list items).
Any help would be highly appreciated.
var macro;
macro = "CODE:";
macro += "VERSION BUILD=000000" + "\n";
macro += "TAB T=1" + "\n";
macro += "SET !ERRORIGNORE YES" + "\n";
macro += "SET !EXTRACT_TEST_POPUP NO" + "\n";
macro += "SET !DATASOURCE source.csv" + "\n";
macro += "SET !DATASOURCE_COLUMNS 1 " + "\n";
macro += "SET !LOOP 1" + "\n";
//macro += "SET !TIMEOUT 3" + "\n";
macro += "SET !DATASOURCE_LINE {{i}}" + "\n";
macro += "URL GOTO=http://site.com/?what={{!COL1}} " + "\n";
macro += "TAG POS={{n}} TYPE=LI ATTR=CLASS:classofdiv" + "\n";
macro += "TAG POS={{n}} TYPE=SPAN ATTR=TXT:* EXTRACT=TXT" + "\n";
macro += "SAVEAS TYPE=EXTRACT FOLDER=* FILE=All_list_items.txt" + "\n";
for (var i=1;i<20;i++)
{
iimSet("i",i)
iimPlay(macro)
iimSet("n",i)//<-- How to grab all the TAG POS of the website?
}
Edit 1.1 - I should point out that I use the term {{n}} as example to loop list items (div-ul-li-span). If replaced with 'POS=1' the script works, but ofcourse only saves the first list item instead of all the list items.