This functionality is supported only if you are using the Open Agent.
This topic describes how you can locate a control, which does not provide any meaningful attributes that can be used in locators,
when a stable locator for a sibling of the control is available.
Assume that you have already identified the control
, which has the following stable locator:
If you know that
has a following-sibling of the type
, you can use the following code to build a stable locator for the sibling:
You can also use the sibling approach to identify text fields. Text fields often do not provide any meaningful attributes
that can be used in locators. By using the label of a text field, you could create a meaningful locator for the text field,
because the label is the best identifier for the text field from the perspective of a tester. You can easily use the label
as a part of the locator for a test field by using the sibling approach. For example, if the text field is a preceding-sibling
of a label with the text
, you can use the following locator: