Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
11043 Lượt xem

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"/>
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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
Ảnh đại diện
Huỷ bỏ
Tác giả

Thank you very much for your answer.

No problem, best of luck with Odoo!

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 4 20
3185
1
thg 8 19
5726
1
thg 10 16
5872
1
thg 2 25
1975
3
thg 12 24
1087