I'd test against div
rather than *
if there are only divs
there.
This XPath will select the div
under one with an id of cards
that has an id that starts with pmt-id-
and also has a descendant div
of class type2
:
'//div[@id="cards"]//div[starts-with(@id,"pmt-id-") and .//div[contains(@class, "type2"]]'
Note that you may have to take extra care with the matching against the @class to avoid matching type22
or abctype2
if such types are possible.