我有以下标记:
<div>
<div>Question1</div>
<div>
<button type="button">No</button>
<button type="button">Yes</button>
</div>
</div>
<div>
<div>Question2</div>
<div>
<button type="button">No</button>
<button type="button">Yes</button>
</div>
</div>
以下 XPath 表达式定位两个是按钮:
//div/div/button[text()='Yes']
但是我只想要Yes
第一个 div 的按钮,如下所示:
//div/div[text()='Question1']
我怎样才能找到它?