Tech support just completed this customer macro creation project. The task was to convert an existing iMacros macro to Ui.Vision. In the customer’s own words:
Attached is the IMacro macro I have used for many years. It was inefficient but it worked. I am hoping that with UI.Vision, I can replicate the Imacros macro and then make it more efficient as well. But we can start with that.
*The purpose of this macro is to *
1) go to this website:
Home - Louisiana State Legislature
*2) Select “Bills” in the top menu *
3) Select any session (but let’s pick 2023 Regular session)
4) Go to the bottom and for Search by Instrument Range, pick HB and then click search
Note: With IMacros, I would set the webpage on the HB, SB or other classification before starting the macro. So it was already set up to begin scraping the page. But UI Vision doesn’t seem to let me do that so I have to start at the main legislative page and find my way to the list of bills
5) I have set the page length to display 100 bills at a time.
6) Scrape each bill and append each bill info record to a csvfile. There should be one record per bill in the file.
7) Once the bottom of the page is reached, press the arrow at the bottom to go to the next page. This process should continue until there are no more pages. Depending on how many pages I expected, I would set the loop to that number of pages before starting the run loop in Imacros.
8) Once I finish all the pages for the HB bills, I would then return and Search for all SB bills and so forth. All are added to the same csv file. Once I have finished and processed the csvfile in another application, I would delete that csvfile before starting the process all over again.
In the Imacros macro, I have 100 sets of instructions to accommodate 100 bills on a page. I am sure with UI Vision, this could be accomplished with a do while loop.
iMacros web scraping video:
iMacros macro:
VERSION BUILD=8021970
TAB T=1
TAB CLOSEALLOTHERS
SET !EXTRACT_TEST_POPUP NO
SET !REPLAYSPEED FAST
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl0_HyperLink1 EXTRACT=HREF
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl0_HyperLink1 EXTRACT=TXT
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl0_LinkAuthor EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl0_LabelKWordAndSTitle EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl0_LabelStatus EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl0_LabelConsidered EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=mytable.csv
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl1_HyperLink1 EXTRACT=HREF
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl1_HyperLink1 EXTRACT=TXT
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl1_LinkAuthor EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl1_LabelKWordAndSTitle EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl1_LabelStatus EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl1_LabelConsidered EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=mytable.csv
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl2_HyperLink1 EXTRACT=HREF
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl2_HyperLink1 EXTRACT=TXT
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl2_LinkAuthor EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl2_LabelKWordAndSTitle EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl2_LabelStatus EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl2_LabelConsidered EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=mytable.csv
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl3_HyperLink1 EXTRACT=HREF
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl3_HyperLink1 EXTRACT=TXT
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl3_LinkAuthor EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl3_LabelKWordAndSTitle EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl3_LabelStatus EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl3_LabelConsidered EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=mytable.csv
(Many more lines like this... )
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl97_HyperLink1 EXTRACT=HREF
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl97_HyperLink1 EXTRACT=TXT
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl97_LinkAuthor EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl97_LabelKWordAndSTitle EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl97_LabelStatus EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl97_LabelConsidered EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=mytable.csv
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl98_HyperLink1 EXTRACT=HREF
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl98_HyperLink1 EXTRACT=TXT
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl98_LinkAuthor EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl98_LabelKWordAndSTitle EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl98_LabelStatus EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl98_LabelConsidered EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=mytable.csv
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl99_HyperLink1 EXTRACT=HREF
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl99_HyperLink1 EXTRACT=TXT
TAG POS=1 TYPE=A ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl99_LinkAuthor EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl99_LabelKWordAndSTitle EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl99_LabelStatus EXTRACT=TXT
TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ctl00_PageBody_PageContent_ListViewSearchResults_ctrl99_LabelConsidered EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=mytable.csv
TAG javascript:__doPostBack('ctl00$ctl00$PageBody$PageContent$DataPager1$ctl02$ctl00','');
WAIT SECONDS = 5