For the life of me I cannot work out how to identify a checkbox based on its neighboring text label. Consider a page with checkboxes for each US state. The HTML contains multiple divisions which each contain a checkbox input and a label containing the US state. See attached code example screenshot.
There must be a way I can create a test object for each checkbox that references its association with a given state? I was wondering if xpath:neighbor can help (but can’t yet understand how to use this). I also tried to find a way of creating a hierarchy in the object repository, so I create each div and then UNDER it have a checkbox, but this doesn’t seem possible (I even tried creating an iframe test object with the same xpath as the DIV, and then dragged a checkbox input within it, but that didn’t work either).
I must be missing something as this has to be a common necessity.