"clicking" the last TAG on a page

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.

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.

"clicking" the last TAG on a page

by slessard on Sat Mar 21, 2009 8:04 pm

I want to "click" on the last matching link on a page.

The wildcards in the ATTR parameter of the TAG command will result in multiple matches. I don't know how many matches there will be, but I do know that I always want the last match. Is there a way to "click" on the last matching link?

The code below "clicks" on the third matching link. How can I "click" on the last matching link?
Code: Select all
TAG POS=3 TYPE=A ATTR=TXT:*<SP>*<SP>{{!NOW:yyyy}}
slessard
 
Posts: 2
Joined: Sat Mar 21, 2009 7:52 pm

Re: "clicking" the last TAG on a page

by Tech Support on Mon Mar 23, 2009 3:47 am

Please use negative (backward) relative positioning with TAG POS=R-1 to find the last element in a list.

Example:
find last element of a list with r-1.png
find last element of a list with r-1.png (18.85 KIB) Viewed 6588 times

Test macro:
Code: Select all
URL GOTO=http://www.iopus.com/imacros/demo/v6/pos/index.htm
TAG POS=1 TYPE=SPAN ATTR=TXT:Note:<SP>In<SP>this*
TAG POS=R-1 TYPE=A ATTR=TXT:Click<SP>to<SP>open<SP>this<SP>page
User avatar
Tech Support
 
Posts: 5003
Joined: Tue Sep 20, 2005 12:25 pm

Re: "clicking" the last TAG on a page

by slessard on Thu Mar 26, 2009 11:17 pm

Thanks for the help!

I didn't realize that I could use relative positioning with a mix of TAG types. In my case I had to get the anchor tag's position relative to the last DIV on the page. It worked quite well.
slessard
 
Posts: 2
Joined: Sat Mar 21, 2009 7:52 pm


Return to iMacros for Firefox

Who is online

Users browsing this forum: No registered users and 11 guests

-->