Search code examples
web-scrapingimacrosextract

iMacros extracting POS from a search


I am trying to work out how to extract the POS of a piece of text, and then use the extracted value to click a link based on the extracted information as part of a web scraping imacro. All the links on this page have the same text and are identified by a number in a different column of the table. For example, link A1 is in TD1, but the unique identifier is in TD2. To work out the link POS I'm adding 4 to the unique number POS and then dividing by 6.

The code I have so far is this, but when the imacro runs it is unable to extract the position using the search function.

SEARCH SOURCE=TXT:{{number}} EXTRACT=POS
SET !VAR1 {{!EXTRACT}}
ADD !VAR1 4
SET !VAR1 EVAL("!VAR1 / 6")
TAG POS=!VAR1 TYPE=A ATTR=CLASS:align-left

Is there a way I can modify this code to click the link based on a unique number in a different cell, or a different way I can do this?


Solution

  • Try using relative positioning for this scenario:

    TAG POS=1 TYPE=TD ATTR=TXT:{{number}}
    TAG POS=R-1 TYPE=A ATTR=CLASS:align-left