Access and validate a html checkbox
Posted: Mon Jul 22, 2019 3:08 pm
Hi Ranorex forum,
in a web application I have a (invisible) checkbox:
In the repository I identify the element as WebElement and Ranorex Spy has no problem to find the element:
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
in a web application I have a (invisible) checkbox:
In the repository I identify the element as WebElement and Ranorex Spy has no problem to find the element:
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