18 January 2026:


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.

Radio Button - Onlick JS

I've tried the normal script but my test case fail, the reason is because my radio button is calling a javascript function when clicked (onClick). So, I'm trying to use the modified script but it isn't working as well.

Any idea?

Thank You

Normal Script
_check(_radio("/employeeId/", _near(_cell("Mr A"))));

Modified Script:
$name = _getText(_cell("Mr A")).toString();
$department = _getText(_rightOf(_cell($name))).toString();
$designation = _getText(_rightOf(_cell($department))).toString();
$id = _radio("/userId/", _near(_cell("Mr A"))).value;
setValue($name, $id, $designation);
_click(_radio(0,_near(_leftOf("Mr A"))));

Javascript
function setValue(name, id, title) {
document.forms[0].name1.value = name;
document.forms[0].routeUserId1.value = id;
document.forms[0].title1.value = title;
}

JSP
<tr class="even">
<td><input type="radio" name="employeeId" value="111" onclick="javascript:setValue('Name', 'ID', 'Title')"/></td>
</tr>
Sign In or Register to comment.