Get multiple elements using find children


#1

How do I get all the product details (for ages etc) using find children (or other) activity? Many thanks!

Some examples of pages I need to retrieve are:

https://www.bookdepository.com/Very-Hungry-Caterpillar-Little-Learning-Library-Eric-Carle/9780141385112?ref=grid-view

https://www.bookdepository.com/When-Breath-Becomes-Air-Paul-Kalanithi/9781784701994?ref=grid-view

Note: “for ages” field are not always present.

Snippet of the source code:

ul class=“biblio-info”>

                <li>
                        <label>Format</label>
                        <span>
                            Paperback
                                | <span itemprop="numberOfPages">256 pages</span>
                            </span>
                    </li>
                <li>
                        <label>Dimensions</label>
                        <span>
                            129
                                x 198
                                x 16mm
                            
                                | 181g
                            </span>
                    </li>
                <li>
                        <label>Publication date</label>
                        <span itemprop="datePublished">05 Jan 2017</span>
                    </li>
                <li>
                        <label>Publisher</label>
                        <span itemprop="publisher" itemtype="http://schema.org/Organization" itemscope="Vintage Publishing">
                            <a href="/publishers/Vintage-Publishing" itemprop="url">
                                <span itemprop="name">
                                    Vintage Publishing</span>
                            </a>
                        </span>
                    </li>
                <li>
                        <label>Imprint</label>
                        <span>VINTAGE</span>
                    </li>
                <li>
                        <label>Publication City/Country</label>
                        <span>
                            London, United Kingdom</span>
                    </li>
                <li>
                        <label>Language</label>
                        <span>
                            English</span>
                    </li>
                <li>
                        <label>ISBN10</label>
                        <span>1784701998</span>
                    </li>
                <li>
                    <label>ISBN13</label>
                    <span itemprop="isbn">9781784701994</span>
                </li>

                <li>
                        <label>Bestsellers&nbsp;rank</label>
                        <span>
                            23</span>
                    </li>
                </ul>

#2

I use the following selectors for find children:
webctrl parentclass=‘biblio-*’ /

It returned the following:
For ages 0-5 Format Board book | 48 pages Dimensions 100 x 126 x 53mm | 332g Publication date 10 Jan 2011 Publisher Penguin Books Ltd Imprint PUFFIN Publication City/Country London, United Kingdom Language English Illustrations note Full colour illustrations throughout ISBN10 0141385111 ISBN13 9780141385112 Bestsellers rank 154

I guess I could use string manipulation to get all its value. I wonder if there is a more elegant method?


#3

Hello @Tan_Yong_Heng, I am not sure if it is a more elegant way or not, but to add you choices:

If you are clear on what data you want, you can look for the sibling. Since it seems like it always have the pattern like this,

  • Publisher PUFFIN <\li>

    then you can use something like:

    1. Get Anchestor of the Publisher label (as parent)
    2. Then Find Children of parent, filter with label
    3. You get the “PUFFIN” value, no need to do complex string manipulations
    4. Do the same for the other information

    The merit is it is simpler once you get the value, but you need to iterate it as much as the data you want.


  • #4

    Thank you. This solves my problem. :slight_smile:


    #5

    Nice to hear that @Tan_Yong_Heng :slight_smile: