Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
11509 Weergaven

Watching this sample code, how to xpath pointing to the second element called "example_a"?:

<span class="example_a"/>
<span class="example_b"/>
<span class="example_a"/>
Avatar
Annuleer
Beste antwoord

Hi Roberto,

If you'd gave all classes an unique name you could do the following:

<xpath expr="//span[@class='example_a']>
    <!-- Some code here -->
</xpath>
But, since this is not the case, you should just use an index. For example:

<xpath expr="//span[3]">
    <!-- Some code here -->
</xpath>
This will search the third element that is a span. This code literally says 'get me the third item that is a span'.
Yenthe
Avatar
Annuleer
Auteur

Thank you very much for your answer.

No problem, best of luck with Odoo!

Gerelateerde posts Antwoorden Weergaven Activiteit
0
apr. 20
3681
1
aug. 19
6354
1
okt. 16
6496
1
feb. 25
2530
3
dec. 24
2216