javascript - imacros firefox loop through results and extract -


i using imacros free plugin firefox scrape data javascript search form on website. here breakdown of current macro works extract 1 set of results me.

the portion of macro below automatically enters keyword "superman" search form.

version build=8300326 recorder=fx tab t=1 url goto=http://www.example.com/pricelist frame f=1 tag pos=1 type=input:text form=action:/pricelistsearchform/ attr=id:keyphrase content=superman tag pos=1 type=input:submit form=action:/pricelistsearchform attr=name:searchbarcode&&value:get<sp>value 

a list of results load. use following xpath expression select first result appears in list:

tag xpath=id('searchform')/form/fieldset/table/tbody/tr[3]/td[1]/a 

the form reloads name , price of selected product , use these 2 xpath expressions extract data:

tag xpath=id('results')/table/tbody/tr[2]/td[2] extract=txt tag xpath=id('results')/table/tbody/tr[2]/td[4] extract=txt 

i use statement brings me results list.

this works fine extract first result in list i.e "superman". there many other results loop through , scrape (superman 2, superman 3, superman special edition e.t.c). multiple results listed in following format:

tag xpath=id('searchform')/form/fieldset/table/tbody/tr[3]/td[1]/a   ..i.e superman tag xpath=id('searchform')/form/fieldset/table/tbody/tr[4]/td[1]/a   ..i.e superman 2 tag xpath=id('searchform')/form/fieldset/table/tbody/tr[5]/td[1]/a   ..i.e superman 3 ...etc 

i use loop select each of these results 1 @ time, extract name , price , go , select next result in list , on. assume need use wildcard (*) symbol , {{!loop}} statement im unsure of how implement these in code or whether need use javascript.

many help

try this

set !loop 3 tag xpath=id('searchform')/form/fieldset/table/tbody/tr[{{!loop}}]/td[1]/a 

or simple

set !loop 3 tag pos={{!loop}} type=a attr=id:searchform extract=txt 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -