Run alternate command in iMacros when TAG not found

heltonbiker picture heltonbiker · Oct 7, 2013 · Viewed 11.3k times · Source

I have created an iMacros script in Firefox, which activates the "Next" link in a set of pages, but every once in a while there is a sort of a "would you like to continue" page, where the "Next" tag doesn't exist, and a "Would you like to continue?" tag exists instead.

My current script is this:

TAG POS=1 TYPE=A ATTR=TXT:Next

And I would like it to be something like this (pseudocode):

try {
    TAG POS=1 TYPE=A ATTR=TXT:Next
} catch (Error -921) {
    'Firefox error for "TAG not found"
    TAG POS=1 TYPE=A ATTR=TXT:Would<SP>you<SP>like<SP>to<SP>continue?
}

UPDATE: according to the accepted answer, the final form is the following:

SET !ERRORIGNORE YES
SET !TIMEOUT_PAGE 10
SET !TIMEOUT_TAG 0
TAG POS=1 TYPE=A ATTR=TXT:Next<SP>>
TAG POS=1 TYPE=A ATTR=TXT:Continue
SAVEAS TYPE=HTM FOLDER=* FILE=mensagem+{{!URLCURRENT}}.htm

Some remarks:

  • !TIMEOUT_TAG is set to zero, otherwise it would create waiting interval for every loop, since one of the tags will always fail for a given page;
  • !TIMEOUT_PAGE has a relatively large value, but it's only a maximum value, since it seems to get going as soon as the page loads, and the script is running as fast as it can;

Answer

Bestmacros picture Bestmacros · Oct 8, 2013

try this:

SET !ERRORIGNORE YES
TAG POS=1 TYPE=A ATTR=TXT:Next
TAG POS=1 TYPE=A ATTR=TXT:Would<SP>you<SP>like<SP>to<SP>continue?