Noob Question: How to conitnue loop on error

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
azscottd
Posts: 1
Joined: Thu Feb 19, 2009 10:49 pm

Noob Question: How to conitnue loop on error

Post by azscottd » Thu Feb 19, 2009 10:57 pm

Brand new to iMacros on FF Linux.

I've written a macro that uses a CSV datasource to construct the URL's to forms I wish to submit. These URL's occasionally end in a redirect to an error page which doesn't contain the form contents the macro expects and it errors out.

I confess I've not completely read the user documentation yet - have only sped over it and the available examples but what I think I'm looking for is a way to first check to see if the page contains a particular string of text and if not, continue the loop.

Can someone help me along?

Thanks.

Code: Select all

VERSION BUILD=3700331       
TAB T=1     
CMDLINE !DATASOURCE groups.csv
SET !DATASOURCE_COLUMNS 1
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO=http:/website/{{!COL1}}/signup
' heres where i'd like to check for existence of text, form, input, etc and continue if not present
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:frmJoin ATTR=NAME:email CONTENT=me@mydomain.com
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:frmJoin ATTR=ID:SE CONTENT=YES
TAG POS=1 TYPE=INPUT:RADIO FORM=NAME:frmJoin ATTR=ID:r1
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:frmJoin ATTR=ID:coc CONTENT=YES
TAG POS=1 TYPE=A ATTR=TXT:Join<SP>Now 
User avatar
322126384
Posts: 32
Joined: Sat Jul 23, 2011 1:39 am

Re: Noob Question: How to conitnue loop on error

Post by 322126384 » Sun Jul 31, 2011 2:57 am

You can use the command SET!ERRORIGNORE YES (http://wiki.imacros.net/!ERRORIGNORE), so that the macro continues without having an error and stopping. But there is a default wait time that slows down the macro and you can speed this up by using the SET !TIMEOUT (http://wiki.imacros.net/!TIMEOUT) command.

If you are trying to find a specific string and stop the macro when found, then you can use the:

Code: Select all

TAG POS=1 TYPE=* ATTR=TXT:*String that you are looking for* CONTENT=EVENT:FAIL_IF_FOUND
-322126384
MattBell7
Posts: 627
Joined: Thu Nov 26, 2009 11:07 am
Location: United Kingdom

Re: Noob Question: How to conitnue loop on error

Post by MattBell7 » Sun Jul 31, 2011 11:07 am

that doesn't necessarily continue the loop on error, it continues the macro, if you want to allow the error, but move to the next row you'll need to use the scripting interface
Post Reply