问题
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