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 } }
Answer: 1
Why do you think that it was not checked even though it was shown as checked? It sounds like a script is normally executed when the checkbox is checked, if so you could try the following code:
Mouse.Click(EMlevelReason);
by : user1948657http://stackoverflow.com/users/1948657Answer: 2
We were able to develop a workaround for this. We used the click()
event instead of check()
i.e. in the above code we just replaced EMlevelReason.Check()
with EMlevelReason.Click()
Don't know why but it works now :)
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog