Zara.fr website - Category retrieval - find children ul / li elements

I use the activity find children to have the “LI” tags (in green on the photo below), the problem is that I get the tags in red besause the two lots have the same class name.
Here is what I put on the Edit selector :

Do you have any ideas to solve this problem ?

@ali_sd
WE cant See the selector Info. Use the Code Format Button of this Editor in Case of you want Share Code with us.

However, Check If the find children ist pointing direct to the Green li parent Ul element. From the tree structure Reading the Green li should be possible.

 <webctrl class='_subcategories subcategory-menu subcategory-menu--level-2*' tag='UL' />

@ppr Here is the code I used

@ali_sd1
Find children has a selector identifying from where to Look and a Filter to specify what to fetch.

Your selector ist looking more Like the filtern what did you used for the Main selector?

Let me know If you need more introduction help on find children

1 Like

@ppr
according to you what is missing in my code to be able to recover the block of code in green ?

And yes I want to know how to use the filter in the activity find children

@ali_sd
Have a look here


So configure the target selector to UL
And use for filter
<webctrl class='XXX*' tag='LI' />
XXX = is the classname from LI element

For a first test I would suggest to make use of the idx Info to the UL element in the Selector.

Let me know if this is working. Later we can have a look on making it more dynamic

BTW: if this is public link feel free to share it

There is a tag there dataseocategoryid. It seems the LI tags you want have values less than 1000, while the others you don’t want are greater than 1000,

Cycle through your results in a ForEach loop. Inside that place an IF condition with the following:

Convert.ToInt32(element.Selector.GetTag(element.Selector.GetTagCount-1).GetAttributeValue(“data-seocategory-id”).ToString) < 1000

Then: Add element details to a datatable ELSE do nothing.

Something like that

@ppr
For the filter I use :

<webctrl class="_category-link-wrapper menu-item menu-item--level-1*" tag='LI' />

I also tried :

<webctrl class="_category-link-wrapper menu-item menu-item--level-1*" data-name="NOUVELLE COLLECTION"  tag='LI' />

But it still doesn’t work.
I share with you my workflow if you can take a look :
Main.xaml (24.1 KB)

What do you mean that it doesn’t work?

Is it still returning both the green and red blocks? In that case, why not filter the full results in the way I suggested, by using the value of the data-seocategory-id as this is what seems to differentiate the two blocks.

1 Like

@ali_sd
You are interested on the Menu Items from TRF cateory. As you have seen the li items in the F12 Browser Tool, you started to retrieve them. But TRF Category was not expanded, right?

Would TRF Category be expanded you could make use of the “_category-link-wrapper menu-item menu-item–level-2 menu-item–current menu-item–selected” from some Parents for anchoring purpose.

Give me some time for some more detail structure analysis. I will revert back to you with some more ideas

1 Like

@ppr
Thank you for the time you devote to resolving my request.
And in reality what I want to do is browse the children of all the classes “_subcategories subcategory-menu subcategory-menu–level-2”, but I can only get those from the LI tag and the Data-name = “FEMME”.
So if I manage to get the children of the LI tag with the data-name = “TRF” I will be able to loop later to browse the rest.
Indeed if I manage to filter on the parents data-name = “XXX” of the LI tag above, the problem will be solved.

@ali_sd
I brought TRF into the Picture due this is the green block of the screenshot. Femme is the red one.

However give me some time and I focus on reading out from a category by a particular parameter. then we are ready for femme, TRF, Homme, Enfants, Bags and shoes.

Just give me some time I will do it later after my Jobwork. We are close to the solution

1 Like

Perfect !
I’m impatiently waiting for your answer :pray:

@ronanpeter
In fact the purpose behind it is to make a loop on the different classes “_subcategories subcategory-menu subcategory-menu – level-2"
Certainly if I were on a static thing your solution could help.

@ali_sd

PFA demo XAML from the first RnD round:
ali_sd.xaml (19.5 KB)

It is showcasing following:

  • retrieval LIs as Uielements
    • level 2 elements from a particular category
    • level 3 elemets from a particular Level 2
    • All level 3 elements from a particular category

For presenting the dedicated access I incorporated some dynamic filled input dialogs e.g.
grafik

So have a look on the logs and crosscheck the retrival results
grafik

In a next iteration the implementation can be aligned to your detailed retrieval process.
Kindly note: Save the xaml into your UiPath Project properly and dont open it directly from browser.

Let me know your feedback.

1 Like

Hi @ali_sd,

I have done some changes in your workflow so I have obtained a result like this
image

I hope this can help you

Main (3).xaml (18.0 KB)

@cmolina
image
Can you reload the script ?

Hi @ali_sd

Check ui.automation.activities package is installed or updated

Thanks
Ashwin.S

1 Like

@ali_sd try what @AshwinS2 said

As reference, these are my dependencies

image

1 Like