newbie: Extract A HREF or Checkbox variable

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

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
vinotrellis
Posts: 2
Joined: Mon Mar 12, 2018 4:11 pm

newbie: Extract A HREF or Checkbox variable

Post by vinotrellis » Tue Mar 13, 2018 6:24 pm

How do I get the HREF from the Anchor tag or extract the "recordIDs" checkbox variable below and use URL GOTO to for clicking the link? I am executing a search results from a CSV file loop and need to go to the Detail page of each Contact record. I am having trouble referencing the EXTRACT=HREF as the script cannot find the Anchor so not sure how to do this yet. the

Code: Select all

VERSION BUILD=12.0.501.6698
TAB T=1
' TAB CLOSEALLOTHERS
'SET !PLAYBACKDELAY 1.03

SET !DATASOURCE CrownPointContactRemoveList.csv
SET !LOOP 8
SET !DATASOURCE_LINE {{!LOOP}}

URL GOTO=https://siteadmin-staging.vin65.com/dashboard/index.cfm?method=welcome.frames

'click Contacts 
TAG POS=1 TYPE=A ATTR=TXT:Contacts

'enter Email from CSV and search 
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:email CONTENT={{!COL11}}
TAG POS=1 TYPE=BUTTON:SUBMIT ATTR=TXT:Search

'get HREF from Anchor tag in html 
'ERROR: can't find anchor tag 
TAG POS=1 TYPE=A ATTR=TXT:Cust<SP>No:<SP>*{{!COL11}}*<SP>Email:<SP>*{{!COL11}}*<SP>Phone:<SP>*{{!COL12}}* EXTRACT=HREF

'hardcoded this works
TAG POS=1 TYPE=A ATTR=TXT:Cust<SP>No:<SP>1085<SP>Email:<SP>johndoe@aol.com<SP>Phone:<SP>(510)<SP>555-6178 EXTRACT=HREF

URL GOTO={{!EXTRACT}}

Code: Select all

	<table class="table table-hover table-striped">
			<tbody>
			<tr>
				<th></th>
				<th>Name / Address</th>
				<th>Info</th>				
				<th>Stats</th>			
				<th></th>
			</tr>
			
				<tr>
					<td><input type="checkbox" name="recordIDs" value="045DCA49-A11C-127B-4A96-622311917403"></td>
					<td><a href="index.cfm?method=contactListings.view&contactID=045DCA49-A11C-127B-4A96-622311917403&urlstring=CUSTOMSEARCH%3D%26phone%3D%26ZIPCODE%3D%26firstName%3D%26DATEMODIFIEDFROM%3D%26customerNumber%3D%26email%3Djohndoe%2540aol%252Ecom%26company%3D%26Q%3D%26DATEMODIFIEDTO%3D%26city%3D%26stateCode%3D%26contactTypeID%3D%26lastName%3D%26&page=1">
						
						<strong>John Doe </strong><br>
						1008 John Doe DR<br>
						John Doe City,
						CA,
						94530
					</a></td>
					<td><a href="index.cfm?method=contactListings.view&contactID=045DCA49-A11C-127B-4A96-622311917403&urlstring=CUSTOMSEARCH%3D%26phone%3D%26ZIPCODE%3D%26firstName%3D%26DATEMODIFIEDFROM%3D%26customerNumber%3D%26email%3Djohndoe%2540aol%252Ecom%26company%3D%26Q%3D%26DATEMODIFIEDTO%3D%26city%3D%26stateCode%3D%26contactTypeID%3D%26lastName%3D%26&page=1">
						Cust No: 1085<br>
						Email: johndoe@aol.com<br>
						Phone: (510) 555-6178 
					</a></td>
					<td><a href="index.cfm?method=contactListings.view&contactID=045DCA49-A11C-127B-4A96-622311917403&urlstring=CUSTOMSEARCH%3D%26phone%3D%26ZIPCODE%3D%26firstName%3D%26DATEMODIFIEDFROM%3D%26customerNumber%3D%26email%3Djohndoe%2540aol%252Ecom%26company%3D%26Q%3D%26DATEMODIFIEDTO%3D%26city%3D%26stateCode%3D%26contactTypeID%3D%26lastName%3D%26&page=1">
						# of Orders: 0<br>
						Last Order: <br>
						LTV: $0.00<br>
						Contact Status: Prospect
					</a></td>
					<td class="text-right"><a href="index.cfm?method=contactListings.view&contactID=045DCA49-A11C-127B-4A96-622311917403&urlstring=CUSTOMSEARCH%3D%26phone%3D%26ZIPCODE%3D%26firstName%3D%26DATEMODIFIEDFROM%3D%26customerNumber%3D%26email%3Djohndoe%2540aol%252Ecom%26company%3D%26Q%3D%26DATEMODIFIEDTO%3D%26city%3D%26stateCode%3D%26contactTypeID%3D%26lastName%3D%26&page=1"><i class="icon-search"></i></a></td>
				</tr>
			
			</tbody>
		</table>

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

Re: newbie: Extract A HREF or Checkbox variable

Post by chivracq » Tue Mar 13, 2018 7:27 pm

vinotrellis wrote:How do I get the HREF from the Anchor tag or extract the "recordIDs" checkbox variable below and use URL GOTO to for clicking the link? I am executing a search results from a CSV file loop and need to go to the Detail page of each Contact record. I am having trouble referencing the EXTRACT=HREF as the script cannot find the Anchor so not sure how to do this yet. the

Code: Select all

VERSION BUILD=12.0.501.6698
TAB T=1
' TAB CLOSEALLOTHERS
'SET !PLAYBACKDELAY 1.03

SET !DATASOURCE CrownPointContactRemoveList.csv
SET !LOOP 8
SET !DATASOURCE_LINE {{!LOOP}}

URL GOTO=https://siteadmin-staging.vin65.com/dashboard/index.cfm?method=welcome.frames

'click Contacts 
TAG POS=1 TYPE=A ATTR=TXT:Contacts

'enter Email from CSV and search 
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:email CONTENT={{!COL11}}
TAG POS=1 TYPE=BUTTON:SUBMIT ATTR=TXT:Search

'get HREF from Anchor tag in html 
'ERROR: can't find anchor tag 
TAG POS=1 TYPE=A ATTR=TXT:Cust<SP>No:<SP>*{{!COL11}}*<SP>Email:<SP>*{{!COL11}}*<SP>Phone:<SP>*{{!COL12}}* EXTRACT=HREF

'hardcoded this works
TAG POS=1 TYPE=A ATTR=TXT:Cust<SP>No:<SP>1085<SP>Email:<SP>johndoe@aol.com<SP>Phone:<SP>(510)<SP>555-6178 EXTRACT=HREF

URL GOTO={{!EXTRACT}}

Code: Select all

	<table class="table table-hover table-striped">
			<tbody>
			<tr>
				<th></th>
				<th>Name / Address</th>
				<th>Info</th>				
				<th>Stats</th>			
				<th></th>
			</tr>
			
				<tr>
					<td><input type="checkbox" name="recordIDs" value="045DCA49-A11C-127B-4A96-622311917403"></td>
					<td><a href="index.cfm?method=contactListings.view&contactID=045DCA49-A11C-127B-4A96-622311917403&urlstring=CUSTOMSEARCH%3D%26phone%3D%26ZIPCODE%3D%26firstName%3D%26DATEMODIFIEDFROM%3D%26customerNumber%3D%26email%3Djohndoe%2540aol%252Ecom%26company%3D%26Q%3D%26DATEMODIFIEDTO%3D%26city%3D%26stateCode%3D%26contactTypeID%3D%26lastName%3D%26&page=1">
						
						<strong>John Doe </strong><br>
						1008 John Doe DR<br>
						John Doe City,
						CA,
						94530
					</a></td>
					<td><a href="index.cfm?method=contactListings.view&contactID=045DCA49-A11C-127B-4A96-622311917403&urlstring=CUSTOMSEARCH%3D%26phone%3D%26ZIPCODE%3D%26firstName%3D%26DATEMODIFIEDFROM%3D%26customerNumber%3D%26email%3Djohndoe%2540aol%252Ecom%26company%3D%26Q%3D%26DATEMODIFIEDTO%3D%26city%3D%26stateCode%3D%26contactTypeID%3D%26lastName%3D%26&page=1">
						Cust No: 1085<br>
						Email: johndoe@aol.com<br>
						Phone: (510) 555-6178 
					</a></td>
					<td><a href="index.cfm?method=contactListings.view&contactID=045DCA49-A11C-127B-4A96-622311917403&urlstring=CUSTOMSEARCH%3D%26phone%3D%26ZIPCODE%3D%26firstName%3D%26DATEMODIFIEDFROM%3D%26customerNumber%3D%26email%3Djohndoe%2540aol%252Ecom%26company%3D%26Q%3D%26DATEMODIFIEDTO%3D%26city%3D%26stateCode%3D%26contactTypeID%3D%26lastName%3D%26&page=1">
						# of Orders: 0<br>
						Last Order: <br>
						LTV: $0.00<br>
						Contact Status: Prospect
					</a></td>
					<td class="text-right"><a href="index.cfm?method=contactListings.view&contactID=045DCA49-A11C-127B-4A96-622311917403&urlstring=CUSTOMSEARCH%3D%26phone%3D%26ZIPCODE%3D%26firstName%3D%26DATEMODIFIEDFROM%3D%26customerNumber%3D%26email%3Djohndoe%2540aol%252Ecom%26company%3D%26Q%3D%26DATEMODIFIEDTO%3D%26city%3D%26stateCode%3D%26contactTypeID%3D%26lastName%3D%26&page=1"><i class="icon-search"></i></a></td>
				</tr>
			
			</tbody>
		</table>

FCI:

Code: Select all

iMB v12.0, OS...?
Ah-ah...!, nearly "funny" but you are very close... (You should have waited until you had finished your Script before opening that wonderful Bottle of Wine to start the Tasting, ah-ah...! :wink: )

=> You are using twice the same '!COL11' both for 'Cust No' and 'Email'... Oops...! :wink:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
vinotrellis
Posts: 2
Joined: Mon Mar 12, 2018 4:11 pm

Re: newbie: Extract A HREF or Checkbox variable

Post by vinotrellis » Wed Mar 14, 2018 2:14 am

PEBCAK for sure. Now the wine can be opened ;) thanks for you spot this mistake. Cheers!
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: newbie: Extract A HREF or Checkbox variable

Post by chivracq » Wed Mar 14, 2018 4:20 am

vinotrellis wrote:PEBCAK for sure. Now the wine can be opened ;) thanks for you spot this mistake. Cheers!
Hum, "Chair" = "Chais" I guess of course...!, ah-ah...! :shock:
("Chais" (French) = "Winery"...!) :wink:

Remember btw to add a "SET !EXTRACT NULL" before your "real" 'EXTRACT' for the URL if you do any other Extracts before that one, or all Extracts will be included in the 'URL GOTO'...
But I guess your 2 Blocks with each, one 'EXTRACT', were only meant for the Forum, and you will only use one for your "real" Script...
("Good Practice" btw to keep in your Script the original Recording (commented out of course) before editing it with Wildcards and Vars...)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Post Reply