Get text from an HTML list using iMacros

1

I'm using imacros to get the text from a list. My HTML is the following ..

<html>
<div class="group">
<ul id="fruit_list">
    <li class="fruit">
        <a class="etiqueta">potato</a>
    </li>
    <li class="fruit">
        <a class="etiqueta">apple</a>
    </li>
    <li class="fruit">
        <a class="etiqueta">banana</a>
    </li>
    <li class="fruit">
        <a class="etiqueta">orange</a>
    </li>
</ul>
</div>
</html>

I tried:

TAG POS=1 TYPE=UL ATTR=ID:fruit_list EXTRACT=HTM
SET neat_list EVAL("var e_s = '{{!EXTRACT}}'; e_s.substring(e_s.indexOf('<li>'), e_s.lastIndexOf('<\/li>')).replace(/(<li>|<\/li>)/g, '').replace(/ +/g, ' ');")
PROMPT {{neat_list}}

I want to show them as follows:

  

Potato apple banana orange

but the result I get:

<ul style="outline: 1px solid blue;" id="fruit_list">  <li class="order">   <a class="etiqueta">potato</a>  </li>  <li class="order">   <a class="etiqueta">apple</a>  </li>  <li class="order">   <a class="etiqueta">banana</a>  </li>  <li class="order">   <a class="etiqueta">orange</a>  </li> </ul>

Is there any way to show the elements correctly?

And my last question is: could I store the elements and then display them?

    
asked by Sergio Ramos 13.02.2018 в 00:43
source

0 answers