我需要测试这个元素何时出现在 DOM 上。我想为此使用“标题”。 NBA 部分保持不变,另一部分 '0c381941-0' 是动态的。
我试过await page.waitForSelector('.identifier.identifier-group[title=`NBA ${idVariable}`)
但那些反引号在那里是 Not Acceptable 。
有什么线索吗?
<dl class="identifier identifier-group" title="NBA 0c381941-0">
<dl class="player-identifier-label identifier" title="NHI 0c381941-0">
<dt><span>NBA</span></dt>
<dd><span>0c381941-0</span></dd>
</dl>
</dl>
最佳答案
await page.waitForSelector(`.patient-identifier-label.identifier[title=NBA ${playerId}`)
关于puppeteer - 如何使用元素标题的一部分在 Puppeteer 或 Playwright 中找到元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62806519/