Extract information from a web page with a map

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 Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.
Post Reply
irvingsd
Posts: 2
Joined: Tue May 29, 2018 5:00 pm
Location: Ciudad de México

Extract information from a web page with a map

Post by irvingsd » Tue May 29, 2018 5:22 pm

Hi!

I trying extract information from the branches of the fedex website, however, only the first branch office is saved, how could I save all the results obtained?

This is the script that I have so far.

VERSION BUILD=12.0.501.6698
TAB T=1
TAB CLOSEALLOTHERS
SET !EXTRACT_TEST_POPUP NO
SET !LOOP 10
'SET !PLAYBACKDELAY 0.00
URL GOTO=https://www.fedex.com/locate/index.html?locale=es_MX
TAG POS=1 TYPE=INPUT:TEXT ATTR=ROLE:search CONTENT=Jalisco
EVENT TYPE=CLICK SELECTOR="#geoAutoComplete>FIELDSET>INPUT:nth-of-type(2)" BUTTON=0
TAG POS={{!LOOP}} TYPE=P ATTR=CLASS:fx-location-title EXTRACT=TXT
TAG POS={{!LOOP}} TYPE=P ATTR=CLASS:fx-location-address EXTRACT=TXT
TAG POS={{!LOOP}} TYPE=DIV ATTR=CLASS:fx-location-times<SP>fx-cf EXTRACT=TXT
TAG POS={{!LOOP}} TYPE=DIV ATTR=CLASS:fx-location-times<SP>fx-cf EXTRACT=TXT
WAIT SECONDS=1.5
TAG POS=1 TYPE=TABLE ATTR=* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=*FILE=*.csv

Regards,
chivracq
Posts: 7722
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Extract information from a web page with a map

Post by chivracq » Tue May 29, 2018 5:58 pm

irvingsd wrote:Hi!

I trying extract information from the branches of the fedex website, however, only the first branch office is saved, how could I save all the results obtained?

This is the script that I have so far.

Code: Select all

VERSION BUILD=12.0.501.6698
TAB T=1
TAB CLOSEALLOTHERS
SET !EXTRACT_TEST_POPUP NO
SET !LOOP 10
'SET !PLAYBACKDELAY 0.00
URL GOTO=https://www.fedex.com/locate/index.html?locale=es_MX
TAG POS=1 TYPE=INPUT:TEXT ATTR=ROLE:search CONTENT=Jalisco
EVENT TYPE=CLICK SELECTOR="#geoAutoComplete>FIELDSET>INPUT:nth-of-type(2)" BUTTON=0
TAG POS={{!LOOP}} TYPE=P ATTR=CLASS:fx-location-title EXTRACT=TXT
TAG POS={{!LOOP}} TYPE=P ATTR=CLASS:fx-location-address EXTRACT=TXT
TAG POS={{!LOOP}} TYPE=DIV ATTR=CLASS:fx-location-times<SP>fx-cf EXTRACT=TXT
TAG POS={{!LOOP}} TYPE=DIV ATTR=CLASS:fx-location-times<SP>fx-cf EXTRACT=TXT
WAIT SECONDS=1.5
TAG POS=1 TYPE=TABLE ATTR=* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=*FILE=*.csv
Regards,
Possibly related to your "SET !LOOP 10", before looking at your Script and the Site, can you first confirm "=10" is the "correct" Value...?

=> As your Script is now currently set, what it will do is extract the 4x Fields for 'POS=10' (on the first Run), then 'POS=11' on the 2nd Run, etc until the Value you've entered in the 'Loop_Max' Field, which must be >10 or your Script will only run/loop once.

The "Purpose" of having a "SET !LOOP 10" Statement in a Script is "normally" that you already ran/looped your Script previously and for any reason, your Script aborted (User-Aborted or RuntimeError) at the end of Loop=9 or during Loop=10 or you deliberately only ran it 9 times, and you want to run/loop it again but you don't want to extract again the first 9 Loops, so you tell your Script to start directly at Loop=10.
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
irvingsd
Posts: 2
Joined: Tue May 29, 2018 5:00 pm
Location: Ciudad de México

Re: Extract information from a web page with a map

Post by irvingsd » Tue May 29, 2018 6:36 pm

When I assign the value of LOPP 1 equal only saves one result, and not all search results.

When I assign the value of LOOP 1 equal only saves one result, and not all search results.

When changing the value, it saves the number of the result that is assigned, for example LOOP 2 and save the second search result , LOOP 3 and save the third search result, they are saved one by one :shock: :shock:
chivracq
Posts: 7722
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Extract information from a web page with a map

Post by chivracq » Tue May 29, 2018 8:45 pm

irvingsd wrote:When I assign the value of LOPP 1 equal only saves one result, and not all search results.

When I assign the value of LOOP 1 equal only saves one result, and not all search results.

When changing the value, it saves the number of the result that is assigned, for example LOOP 2 and save the second search result , LOOP 3 and save the third search result, they are saved one by one :shock: :shock:
Yeah, well, you normally don't need to "assign" a Value for '!LOOP', a "SET !LOOP n" Statement is only read by iMacros on the first Loop anyway to tell your Macro from which Loop_Nb to start.

=> Simply keep the Default "SET !LOOP 1" (and not "10"), and use the 'Play Loop' Button from the iMacros Side Panel where you can specify "10" or "20" or any Value for how many times you want to loop your Macro...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
Post Reply