Hello guys,
For some reason WebUI.verifyElementChecked does not work. Well on same radio button, check method is working and it checks the radio button, but I can’t verify that the element was checked using WebUI.verifyElementChecked()
And here is the error message:
Did you verify visually that WebUI.check
is actually checking the radio?
What does this do?
attr = WebUI.getAttribute(findTestObject('...'), 'checked')
You can println
the value returned or use if(...)
on it.
it prints null for some reason.
attr = WebUI.getAttribute(findTestObject('Object Repository/LoginPage/rememberMe_LoginPage'), 'checked')
Result :
null
Is the element an HTML input
element with type="radio"
(or checkbox
)?
Well that explains everything. The APIs you’re using only work on <input type="checkbox/radio">
elements.
So, I can not use WebUI.verifyElementPresent ? How can I verify that it was checked ?
Yes, you can, but that API does not have anything to do with a checked
property.
An HTML div
element does not support a checked
attribute/property so the WebUI APIs check
and verifyElementChecked
will not work.
The HTML you are dealing with is doing something “special” to handle the notional checked state. Without knowing what it’s doing, I can’t advise. Perhaps you could post more of the HTML so I can see it.
2 Likes
Thank you @Russ_Thomas, I will provide more HTML.
1 Like
this is unchecked checkbox.
And this is checked checkbox: