How to write xpath with contains ID using TestCafé?

一个人想着一个人 提交于 2021-01-28 03:09:55

问题


Need to take the dynamic ID using "contains" keyword in TestCafé selector.

html:

<div id="content-body-14269002-17290547">

xpath:

//div[contains(@id,"content-body")]

I would like to write above xpath in TestCafé Selector Is it possible to do?


回答1:


I believe this is not supported. See here.

A good workaround I can recommend to handle such cases is to use xpath-to-css package.

Also, you can just create a CSS selector for this case, CSS Selector for partial id match will be:

div[id*='content-body']

Hope this is helpful. Good luck!



来源:https://stackoverflow.com/questions/60911169/how-to-write-xpath-with-contains-id-using-testcaf%c3%a9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!