Nested extract problem

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.

Nested extract problem

by TOAZNC on Sun Nov 02, 2008 7:37 pm

I'm not having any luck getting text out of a nested list. Here's an example of the HTML:

<ul class="listing">
<li class="comment">comment is here</li>
.
.
</ul>

Here's the script I am trying:

TAG POS=1 TYPE=UL ATTR=CLASS:listing
TAG POS=R1 TYPE=LI ATTR=CLASS:comment EXTRACT=TXT

But it errors on the second line when I try to extract the data in the "LI". What am I doing wrong?
TOAZNC
 
Posts: 2
Joined: Fri Oct 31, 2008 9:57 pm

Re: Nested extract problem

by Tech Support on Mon Nov 03, 2008 7:55 am

Your macro looks ok => Can you please post the website URL or paste the HTML source code?
User avatar
Tech Support
 
Posts: 5003
Joined: Tue Sep 20, 2005 12:25 pm

Re: Nested extract problem

by TOAZNC on Mon Nov 03, 2008 9:55 am

Tech Support wrote:Your macro looks ok => Can you please post the website URL or paste the HTML source code?


I found out what the problem is. The Search for the LI doesn't begin until after the closing UL. So it never sees any of the LI's I am searching:

<ul class="listing">
*** does NOT start here ***
<li class="comment">comment is here</li>
.
</ul>
*** Starts looking here ***

I was able to figure out another way to do this but would like to know if there is a way to begin a search when it is nested like that.
TOAZNC
 
Posts: 2
Joined: Fri Oct 31, 2008 9:57 pm

Re: Nested extract problem

by Tech Support on Mon Nov 03, 2008 1:51 pm

Thank you for the useful feedback! You are right: Relative positioning TAG POS=R1 starts the search after the anchor element is closed. So it can not be used with nested elements.

nested elements.png
nested elements.png (14.83 KIB) Viewed 4643 times


The best workaround is to use another anchor element before or after the element you want to extract. In our example screenshot, the element with the blue frame can be used, but the element with the red frame can not be used, as it is not before or after (but around) the element we want to extract.

Note that iMacros uses always blue frames, the red color is only used in this screenshot.
User avatar
Tech Support
 
Posts: 5003
Joined: Tue Sep 20, 2005 12:25 pm


Return to iMacros for Firefox

Who is online

Users browsing this forum: Bing [Bot] and 9 guests

-->