18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
How to find value of radio type with the help of lable ?
My HTML Element Like :::
<td>
<input type="radio" checked="" onclick="changeBackupFrequency()" value="-1" id="mailloginterval" name="mailloginterval">
<label id="BackRes.Never">Never</label>
<input type="radio" onclick="changeBackupFrequency()" value="3" id="mailloginterval" name="mailloginterval">
<label id="BackRes.Daily">Daily</label>
<input type="radio" onclick="changeBackupFrequency()" value="2" id="mailloginterval" name="mailloginterval">
<label id="BackRes.Weekly">Weekly</label>
<input type="radio" onclick="changeBackupFrequency()" value="1" id="mailloginterval" name="mailloginterval">
<label id="BackRes.Monthly">Monthly</label>
</td>
Here User only give label name .
For example if user want to select 'Monthly' radio button then they need to give only Name of Radio button.
Here i want to found value from radio type element with the the help of label
eg. For Monthly i want to find value = 1 so from that i can write radio button syntax like
_click(_radio(1));
How ?
<td>
<input type="radio" checked="" onclick="changeBackupFrequency()" value="-1" id="mailloginterval" name="mailloginterval">
<label id="BackRes.Never">Never</label>
<input type="radio" onclick="changeBackupFrequency()" value="3" id="mailloginterval" name="mailloginterval">
<label id="BackRes.Daily">Daily</label>
<input type="radio" onclick="changeBackupFrequency()" value="2" id="mailloginterval" name="mailloginterval">
<label id="BackRes.Weekly">Weekly</label>
<input type="radio" onclick="changeBackupFrequency()" value="1" id="mailloginterval" name="mailloginterval">
<label id="BackRes.Monthly">Monthly</label>
</td>
Here User only give label name .
For example if user want to select 'Monthly' radio button then they need to give only Name of Radio button.
Here i want to found value from radio type element with the the help of label
eg. For Monthly i want to find value = 1 so from that i can write radio button syntax like
_click(_radio(1));
How ?
Comments
you forgot to put on quote("") for value. let me know you were requiring anything else.
i think you do not understand my problem. read again in that i mention i want to find value with the help of label name.
We are checking why _near is not working in this case. (Even if it did, since all the elements are in the same DOM parent, you will still need to use the index of 0,1,2,3 etc.)
Just for information, the code above is quite wrong. The labels should be associated with radio buttons and the ids should be different for different radio buttons. (the name would be same for a given group).
The code below is a corrected version:
In the code above, the radio button would get clicked if you do _click(_label("Daily"));
Regards,
Narayan (from Sumitra's machine)