If you want to conduct a test on only those pages contain a particular element, whose presence cannot be determined by URL, you can target by "ID/class/element".
All you need to do is identify, via the source code of your pages, the ID or class associated with the element in question, then indicate it in the test targeting window. With the help of a dropdown menu, you can also select from a list of all the classes or IDs defined in the page which is loaded in the editor.
Make sure that the element that you select here is specific to the pages that you want to target, and is not present on other pages, which would then be included in the test.
In the example below, the test is targeted on all the pages from the domain example.com containing an element with the class "detail".