使用具有奇怪属性的 xpath 获取按钮
get buttons with xpath with strange attribute
在网页中,我必须 select 所有按钮都像这样:
<button :class="{'complete': isComplete, 'open': open}" :disabled="orderedEvents.length === 0"></button>
但是使用这个 xpath :
//button[contains(@class, 'isComplete, \'open\'')]
不行!
您可以使用 @*[name()]
查找名称中包含冒号的属性,并使用 .
查找其值
//button[@*[starts-with(name(),':class') and contains(., \"isComplete, 'open'\")]]
在网页中,我必须 select 所有按钮都像这样:
<button :class="{'complete': isComplete, 'open': open}" :disabled="orderedEvents.length === 0"></button>
但是使用这个 xpath :
//button[contains(@class, 'isComplete, \'open\'')]
不行!
您可以使用 @*[name()]
查找名称中包含冒号的属性,并使用 .
//button[@*[starts-with(name(),':class') and contains(., \"isComplete, 'open'\")]]