I’ve used the getAttribute to successfully get other attributes such as validationMessage however when I try to use the WebUI.getAttribute method for the validity attribute. It will return null as I tried to print it out. I can’t access anything within the validityState object such as tooShort. It will still return null.
So far as I can tell from your screenshot, validityState is a property, not an attribute. Mostly, Katalon/Selenium will try to smooth over the difference and give you what you want. However, sometimes, it fails.
Question: do you want the whole object returned to Groovy? Or a specific value property?
How would I return the object to Groovy and access a specific property like “tooShort”?
You will need to provide a suitable replacement for
your_element. I couldn’t see enough of the HTML to figure out what that argument should be.