【发布时间】:2020-09-28 19:39:58
【问题描述】:
我有以下html:
<button data-testid="likeButton">
<svg aria-hidden="true">
<use xlink:href="/logo"></use>
</svg>
<span>Like</span>
</button>
现在<use xlink:href 可以是/logo 或/logo-filled
如何在 Puppeteer 中编写 xpath 表达式来获取这些?
我试过这个:
//*[name()='use'][contains(@*='logo')]
但是当我测试它时,我得到了错误:
Unable to perform XPath operation. The prefix "xlink" for attribute "xlink:href" associated with an element type "use" is not bound.
【问题讨论】:
标签: html xml svg xpath puppeteer