Differenciate radio buttons for getting the correct label

Hi,

I have 3 radio buttons for a specific field operationalInitiationVisaForecast:
I’m trying to check the label for each of the 3 radio buttons.

HTML:

<ux-form-control formcontrolname="operationalInitiationVisaForecast" formcontrolvalue="0" radiolabel="Forecast" class="">
<input type="radio" class="" id="ux-509748" name="operationalInitiationVisaForecast" value="0" tabindex="0">
<label class="" for="ux-509748">Forecast</label>
</ux-form-control>
<ux-form-control formcontrolname="operationalInitiationVisaForecast" formcontrolvalue="1" radiolabel="Real" class="">
<input type="radio" class="" id="ux-791383" name="operationalInitiationVisaForecast" value="1" tabindex="0">
<label class="radio-label ng-star-inserted" for="ux-791383">Real</label>
</ux-form-control>
<ux-form-control formcontrolname="operationalInitiationVisaForecast" formcontrolvalue="2" radiolabel="N/A" class="">
<input type="radio" class="" id="ux-929420" name="operationalInitiationVisaForecast" value="2" tabindex="0">
<label class="radio-label ng-star-inserted" for="ux-929420">N/A</label>
</ux-form-control>

I don’t know how to differentiate each radio button whose the name is operationalInitiationVisaForecast.

Could you help me with that ?

Although the name tags are the same, the id tags are different, so include the id tag in your identification of each button.
e.g. id=“ux-509748”, id=“ux-791383”, id=“ux-929420”

@grylion54 Hi, thanks for the response. But I cannot do that because the id can change and the test could not be working. Is there another solution ?

If the id tags change, what about using the value tag, or even possibly the formcontrolvalue tag? You need to find some reference that is unique to each.
e.g. value=“0”, value=“1”, value=“2”

Forecast:  //input[@name="operationalInitiationVisaForecast" and @value="0"]/following-sibling::label

Real:      //input[@name="operationalInitiationVisaForecast" and @value="1"]/following-sibling::label

N/A:       //input[@name="operationalInitiationVisaForecast" and @value="2"]/following-sibling::label