Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
11538 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Autor

Thank you very much for your answer.

No problem, best of luck with Odoo!

Related Posts Odpovědi Zobrazení Aktivita
0
dub 20
3690
1
srp 19
6371
1
říj 16
6504
1
úno 25
2544
3
pro 24
2250