javascript - imacros firefox use csv file to enter keywords into search box and extract results -
i'm using imacros free plugin firefox scrape data javascript search form on website. here breakdown of macro far.
this 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 loads , use following code loop through each of results , extract results:
set !loop 3 tag xpath=id('searchform')/form/fieldset/table/tbody/tr[{{!loop}}]/td[1]/a 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 amend code use csv file automatically enter names search field 1 @ time , loop through , extract results normal.
for example if have csv file looks this: superman, superman 2, superman 3...etc macro enter "superman" search form, loop through results , extract them. should enter "superman 2" , extracts results , on...
i've experimented without success in example below using !datasource command. i'm not sure if need split macro 2 seperate ones have 2 loops in example below, or whether achieved javascript.
version build=8300326 recorder=fx tab t=1 set !datasource titlelist.csv set !datasource_line {{!loop} url goto=http://www.example.com/pricelist frame f=1 tag pos=1 type=input:text form=action:/pricelistsearchform/ attr=id:keyphrase content={{!col1}} tag pos=1 type=input:submit form=action:/pricelistsearchform attr=name:searchbarcode&&value:get<sp>value set !loop 3 tag xpath=id('searchform')/form/fieldset/table/tbody/tr[{{!loop}}]/td[1]/a tag xpath=id('results')/table/tbody/tr[2]/td[2] extract=txt tag xpath=id('results')/table/tbody/tr[2]/td[4] extract=txt
many help
Comments
Post a Comment