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.
Save the state of a RadioButton in a variable
Hello,
I need some help.
For my test I need to save the state of some RadioButtons in a variable.
If the Button is checked I want to write a "1" in the variable and a "0" for an unchecked one.
This is the code which I had written for my test:
######################
var $test;
for (var $k=0; $k<4; $k++)
{
if (_radio($k).checked)
{
$test = "1";
}
else
{
$test = "0";
}
_debug($test);
}
######################
In the Record-Window this code works fine but if I play it in a script I every time get a "1" in $test.
Can you please help me.
Regards,
Julian
I need some help.
For my test I need to save the state of some RadioButtons in a variable.
If the Button is checked I want to write a "1" in the variable and a "0" for an unchecked one.
This is the code which I had written for my test:
######################
var $test;
for (var $k=0; $k<4; $k++)
{
if (_radio($k).checked)
{
$test = "1";
}
else
{
$test = "0";
}
_debug($test);
}
######################
In the Record-Window this code works fine but if I play it in a script I every time get a "1" in $test.
Can you please help me.
Regards,
Julian
Comments
Just change
if (_radio($k).checked)
to
if (_condition(_radio($k).checked))
Regards,
Narayan