Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
11810 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Autore

Thank you very much for your answer.

No problem, best of luck with Odoo!

Post correlati Risposte Visualizzazioni Attività
0
apr 20
4048
1
ago 19
6854
1
ott 16
6942
1
feb 25
2925
3
dic 24
2976