Extracting info until certain element is no longer on site

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
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
OniLinken
Posts: 6
Joined: Sun Nov 06, 2016 5:04 pm

Extracting info until certain element is no longer on site

Post by OniLinken » Mon Nov 14, 2016 5:42 am

Hi. First of all:
Win 10, 64bits, iMacros v11.1.149/Firefox 47 iMacros for FF v9.0.3
In second place, thanks in advance for helping me.

I'm extracting information form a site... with several pages.
I managed to find a way to extract info from the page but, if I need to get to the next page to keep extracting info, I need the macros to "click" the next button.
In the site, there's a '>' symbol that represents the "next page"...

So, I need to do some imacros steps until I can't find the '>' symbol in the site, on several pages.

This code makes the macros to "turn the page": TAG POS=1 TYPE=LI ATTR=TXT:>

Is there a way I can make like a while?

while('>' symbol exist){
several extraction steps and code
TAG POS=1 TYPE=LI ATTR=TXT:> (the "next" click so I can continue the extraction in the next page)
}

Sorry the long post. Thanks in advance.
chivracq
Posts: 9004
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Extracting info until certain element is no longer on si

Post by chivracq » Mon Nov 14, 2016 3:54 pm

OniLinken wrote:Hi. First of all:

Code: Select all

Win 10, 64bits, iMacros v11.1.149/Firefox 47 iMacros for FF v9.0.3
In second place, thanks in advance for helping me.

I'm extracting information form a site... with several pages.
I managed to find a way to extract info from the page but, if I need to get to the next page to keep extracting info, I need the macros to "click" the next button.
In the site, there's a '>' symbol that represents the "next page"...

So, I need to do some imacros steps until I can't find the '>' symbol in the site, on several pages.

This code makes the macros to "turn the page":

Code: Select all

TAG POS=1 TYPE=LI ATTR=TXT:> 
Is there a way I can make like a while?

while('>' symbol exist){
several extraction steps and code
TAG POS=1 TYPE=LI ATTR=TXT:> (the "next" click so I can continue the extraction in the next page)
}

Sorry the long post. Thanks in advance.
What is wrong with simply including that Statement at the End of your Script (I guess you loop it per Page you extract) and your Script will automatically stop once it is not found anymore...? (with '!ERRORIGNORE'=NO of course.)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
OniLinken
Posts: 6
Joined: Sun Nov 06, 2016 5:04 pm

Re: Extracting info until certain element is no longer on si

Post by OniLinken » Tue Nov 29, 2016 1:15 am

Hi! Sorry it took me this long to reply... I got very sick and ended up in the hospital for several days.

I took your advice but my guess is that i'm not using it right.
I thought it should look like this

Code: Select all

<several tasks>
TAG POS=1 TYPE=LI ATTR=TXT:>
SET !ERRORIGNORE NO
the iMacros does change to the next page, but it doesn't repeat the first several tasks
But to be honest, i've never used !ERRORIGNORE and I dont know how to.

Can you help me this last time, please?
Cheers.

EDIT: Just realized iMacros have a loop option and used in my advantage... thanks for everything
chivracq
Posts: 9004
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Extracting info until certain element is no longer on si

Post by chivracq » Tue Nov 29, 2016 4:08 am

OniLinken wrote:Hi! Sorry it took me this long to reply... I got very sick and ended up in the hospital for several days.

I took your advice but my guess is that i'm not using it right.
I thought it should look like this

Code: Select all

<several tasks>
TAG POS=1 TYPE=LI ATTR=TXT:>
SET !ERRORIGNORE NO
the iMacros does change to the next page, but it doesn't repeat the first several tasks
But to be honest, i've never used !ERRORIGNORE and I dont know how to.

Can you help me this last time, please?
Cheers.

EDIT: Just realized iMacros have a loop option and used in my advantage... thanks for everything
Sorry to hear about your "bad" last 2 weeks, no Pb of course that you couldn't follow up quicker...

OK, good to hear that you "discovered" the Loop Functionality, ah-ah...!, and that it indeed solves your Pb...

Mini-Remark: I was mentioning '!ERRORIGNORE' in case you were using it, the Default is already "NO"... (and you would need to place it BEFORE and not AFTER your Statement to click on the 'Next' Button.)

The "best" place to have a look at all Functionality available in iMacros is the Command Reference in the Wiki... :idea:
(And dare to ask and to open new Threads if you encounter any new Pb's or have some more Qt's, that's the "Purpose" of the Forum, ah-ah...!, and searching the Forum or reading a few Forum Pages is a great Resource as well...)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply