chrismdiaz
10 years agoNew Contributor
How can I set the property of a hidden checkbox?
I have a checkbox that I'm trying to set, but it's not visible on the screen. I've tried the call object method and setting it through a script, but I still get the same error: "There was an attempt ...
- 10 years ago
Well, generally speaking, you're trying to have TestComplete use a mouse action to select an item. However, as with any mouse action, if the item cannot be accessed, then you cannot execute the action.
Rather than using ClickChecked, you might want to see if there is a property value of the checkbox that you can set directly. For me, this is a best practice, anyways, because when I'm running an automated test, I'm not as much interested in how well the UI behaves as I am in how the application/page functions when certain values are set. - 10 years ago
If the checkbox is an HTML input element, then you should be able to directly set the checked property. For example to check the box do this:
Aliases.browser.pageMxMerchantDashboard.panelPpsContainer.checkboxLast4DigitsOfCardNumber.checked = True
Or set the value equal to False to uncheck the box.