Need to Extract Current URLs from 2 Tabs and Save to CSV

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.

Moderators: Community Moderators, iMacros Moderators

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.

Need to Extract Current URLs from 2 Tabs and Save to CSV

by JBlack on Wed May 25, 2016 12:14 am

Hi

Noob here. I am trying to create a macro that clicks on 2 links in Tab 1 (this I have figured out) ..and saves the 2 currenturls in CSV. (this is the problem)

This is how I've thought about this:

1. Tab 1
2. Find "First Link" click on it
3. Tab 2
4. Grab CURRENTURL
5. Go back to Tab 1
6. Find "Second Link" click on it
7. Tab 3
8. Grab CURRENTURL
9. Go back to Tab 1

The end result should be 2 different URLs saved in 1 CSV file

Code: Select all
VERSION BUILD=8970419 RECORDER=FX
TAB T=1
TAG POS=1 TYPE=A ATTR=TXT:First<SP>Link<SP>*
TAB T=2
ADD !EXTRACT {{!URLCURRENT}}
SAVEAS TYPE=EXTRACT FOLDER=* FILE=urls.csv
WAIT SECONDS=0.3
SET !EXTRACT NULL
TAB T=1
TAG POS=1 TYPE=A ATTR=TXT:Second<SP>Link<SP>*
TAB T=3
ADD !EXTRACT {{!URLCURRENT}}
SAVEAS TYPE=EXTRACT FOLDER=* FILE=urls.csv
WAIT SECONDS=0.3
TAB T=1


^ This saves the url from Tab 2 TWICE in the CSV file, they should be different URLs (URL from Tab 2 and URL from Tab 3)

Any ideas?
JBlack
 
Posts: 1
Joined: Tue May 24, 2016 11:55 pm

Re: Need to Extract Current URLs from 2 Tabs and Save to CSV

by chivracq on Wed May 25, 2016 3:27 am

JBlack wrote:Hi

Noob here. I am trying to create a macro that clicks on 2 links in Tab 1 (this I have figured out) ..and saves the 2 currenturls in CSV. (this is the problem)

This is how I've thought about this:

1. Tab 1
2. Find "First Link" click on it
3. Tab 2
4. Grab CURRENTURL
5. Go back to Tab 1
6. Find "Second Link" click on it
7. Tab 3
8. Grab CURRENTURL
9. Go back to Tab 1

The end result should be 2 different URLs saved in 1 CSV file

Code: Select all
VERSION BUILD=8970419 RECORDER=FX
TAB T=1
TAG POS=1 TYPE=A ATTR=TXT:First<SP>Link<SP>*
TAB T=2
ADD !EXTRACT {{!URLCURRENT}}
SAVEAS TYPE=EXTRACT FOLDER=* FILE=urls.csv
WAIT SECONDS=0.3
SET !EXTRACT NULL
TAB T=1
TAG POS=1 TYPE=A ATTR=TXT:Second<SP>Link<SP>*
TAB T=3
ADD !EXTRACT {{!URLCURRENT}}
SAVEAS TYPE=EXTRACT FOLDER=* FILE=urls.csv
WAIT SECONDS=0.3
TAB T=1


^ This saves the url from Tab 2 TWICE in the CSV file, they should be different URLs (URL from Tab 2 and URL from Tab 3)

Any ideas?

CIM/FCIM...! :mrgreen:

Your Script mentions iMacros for FF v8.9.7 but I suspect you are running your Script on Chrome (v50...?) using iMacros for CR (v8.3.5...?), sbd else mentioned a similar Pb a few weeks ago on CR... I just tested your (adapted) Script on 2 FF Environments and it works fine, unless it is specific to iMacros for FF v8.9.7...:
Code: Select all
VERSION BUILD=8970419 RECORDER=FX
SET !ERRORIGNORE YES

TAB T=1
'TAG POS=1 TYPE=A ATTR=TXT:First<SP>Link<SP>*

TAB T=2
ADD !EXTRACT {{!URLCURRENT}}
PROMPT {{!URLCURRENT}}<BR>{{!EXTRACT}}
'SAVEAS TYPE=EXTRACT FOLDER=* FILE=urls.csv
WAIT SECONDS=0.3
SET !EXTRACT NULL

TAB T=1
'TAG POS=1 TYPE=A ATTR=TXT:Second<SP>Link<SP>*

TAB T=3
ADD !EXTRACT {{!URLCURRENT}}
PROMPT {{!URLCURRENT}}<BR>{{!EXTRACT}}
'SAVEAS TYPE=EXTRACT FOLDER=* FILE=urls.csv
WAIT SECONDS=0.3

TAB T=1
PAUSE
(Tested on iMacros for FF v8.8.2, Pale Moon v26.1.1 (=FF43), Win10-x64 and iMacros for FF v8.9.6, FF45, Win10-x64.)

The 'SET !EXTRACT NULL' in your original Script is btw not needed, a 'SAVEAS' automatically resets '!EXTRACT'...
- (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...
chivracq
 
Posts: 6484
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to Data Extraction and Web Screen Scraping

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 3 guests

-->