コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
11542 ビュー

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"/>
アバター
破棄
最善の回答

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
アバター
破棄
著作者

Thank you very much for your answer.

No problem, best of luck with Odoo!

関連投稿 返信 ビュー 活動
0
4月 20
3690
1
8月 19
6373
1
10月 16
6504
1
2月 25
2548
3
12月 24
2256