I'm looking for a site where the name of the ID depends on some variables that I can't control.

So the ID can either be "sub_allGoods_4", "sub_allGoods_12" or whatever number:


Is there any way to use a * like to cover those cases?


1 Answer 1


Yes, use the contains function:

//*[contains(@id, 'sub_allGoods_')]
  • @user8459020 no problem, can you accept my reply as answer so the question doesn't remain open?
    – FDM
    Aug 20, 2017 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.