我有一个事件列表,其内容如下:
<div class="all-ebents">
<div class="sport-base-event">
<span class="event-block-current-time__time--VEuoj">63:07</span>
<span class="event-block-score">0:0</span></div>
</div>
<div class="sport-base-event">
<span class="event-block-current-time__time--VEuoj">64:07</span>
<span class="event-block-score">0:1</span></div>
</div>
<div class="sport-base-event">
<span class="event-block-current-time__time--VEuoj">63:07</span>
<span class="event-block-score">0:1</span></div>
</div>
</div>
到目前为止,我已经能够使用以下代码获取事件时间值和计数
//*[contains(@class, "event-block-current-time--")]::text() # get the time block
//*[contains(@class, "event-block-current-time--")]/following-sibling::div::text() # score block
如果事件时间包含值 63 并且相邻元素中的分数为 0:0,那么绕过这些查询并获取父元素的正确方法是什么?
将谓词直接放在父级上,如下所示:
这将获取那些带有 的 div,这些 div 包含
class='sport-base-event'
并且具有值span
63
span
0:0