1

I am trying to find the xpath / count for all the checkboxes under "Categories". but when I am trying to get xpath/count it is getting me all the checkboxes under "Categories" and under "Brands"

How can I get all checkboxes count under "Categories".

attaching the screenshot for the issue, Appreciate your help.

Ravi
  • 13
  • 3

1 Answers1

1

Please add the element structure for the brand also. Assuming, all elements under Brand and categories are under different levels, the xpath you could use is:

//h5[text()='Categories']/../../digital-coupons-filter-by-types/div

It seems both are in the same level:

i tested below locator:

//li[preceding-sibling::*//div[text()='SHOP BY CATEGORY']/..][following-sibling::*//a[@data-menu-id="10"]/..]

and also:

//li[following-sibling::*//a[@data-menu-id="11"]/..]

For amazon uk:

https://www.amazon.co.uk/: click the handburger menu and try out your self

enter image description here

so in your case you could use:

//div[following-sibling::*//h5[text()='Brands']/..]
PDHide
  • 11,065
  • 2
  • 14
  • 42