Access and validate a html checkbox

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
boris0dev
Posts: 15
Joined: Fri Nov 09, 2018 10:28 am

Access and validate a html checkbox

Post by boris0dev » Mon Jul 22, 2019 2:08 pm

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
You do not have the required permissions to view the files attached to this post.

manish
Posts: 47
Joined: Fri Aug 10, 2018 11:46 am

Re: Access and validate a html checkbox

Post by manish » Tue Jul 23, 2019 7:33 am

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