Page 1 of 1

Access and validate a html checkbox

Posted: Mon Jul 22, 2019 3:08 pm
by boris0dev
Hi Ranorex forum,
in a web application I have a (invisible) checkbox:
2019-07-22 13_56_56-Technikertool.png
In the repository I identify the element as WebElement and Ranorex Spy has no problem to find the element:
2019-07-22 14_00_36-Technikertool - Ranorex Studio - (32bit).png
My goal: I want to see if the checkbox is checked.

As it is a webelement I have to convert it to a Ranorex.Checkbox element or at least to an InputTag element - don't I?

There are various ways I tried to do it:

InputTag checkbox = (InputTag)[path to element in repository].CheckboxShowOnscreenKeyboard;
Checkbox checkbox = (Checkbox)[path to element in repository].CheckboxShowOnscreenKeyboard;

I've also set the type of the element in the repository to "Unknown" and tried in multiple ways to create an adapter out of it. Just one way (I don't list all the ideas I had):

CheckBox checkbox = (CheckBox)[path to element in repository].CheckboxShowOnscreenKeyboardInfo.CreateAdapter<Unknown>(false);

In the end I just want to successfully execute:

if (checkbox.Checked) {
Report.Info("checkbox is checked");
}

Any help _very_ appreciated
Thanks,
Boris

Re: Access and validate a html checkbox

Posted: Tue Jul 23, 2019 8:33 am
by manish
Hi,

Could you please upload a Ranorex Snapshot of the checkbox. Unfortunately, it is very difficult to tell about the issue without looking at the snapshot.

BR
Manish