Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
11522 Widoki

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"/>
Awatar
Odrzuć
Najlepsza odpowiedź

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
Awatar
Odrzuć
Autor

Thank you very much for your answer.

No problem, best of luck with Odoo!

Powiązane posty Odpowiedzi Widoki Czynność
0
kwi 20
3683
1
sie 19
6355
1
paź 16
6499
1
lut 25
2537
3
gru 24
2232