I am creating a Ranorex Checkbox object and then grabbing the appropriate checkbox using Ranorexpath. But I am unable to check this checkbox using the CheckBox.Check() event. On the UI, a tick mark appears on the checkbox but in reality the checkbox remains unchecked and as a result the expected messages do not appear on the screen and the test fails. Please let me know what I am doing wrong. Code snipped below:
if(value=="99283" || value =="99281")
{
Ranorex.CheckBox EMlevelReason="/dom[@domain='"+domain+"']//object[#'slApp']/form/form[1]/form/list[@automationid='lstOuter']/listitem[4]/list/listitem[4]/checkbox[@name='Single xray']";
EMlevelReason.Focus();
if(EMlevelReason.Checked!=true)
{
EMlevelReason.Focus();
EMlevelReason.Check(); // doesn't work. the checkbox appears checked on the UI but actually remains unchecked
}
}
We were able to develop a workaround for this. We used the
click()event instead ofcheck()i.e. in the above code we just replaced
EMlevelReason.Check()withEMlevelReason.Click()Don’t know why but it works now 🙂