How to retrieve the value of a span attribute?

Hi Team,

I am trying to retrieve the value of a span attribute, but getting an null exception. Could you please me with the code. I have highlighted the value in red. I also tried with text, span, id but it did not work.

getMsg = WebUI.getAttribute(findTestObject(‘OrangeHRM/Login/span_Invalid credentials’), ‘span’)
println("Captured error message is "+ getMsg)

if(getMsg.contentEquals(“Invalid credentials”))
println(“Login Failed”)Verification

error message
java.lang.NullPointerException: Cannot invoke method contentEquals() on null object


span is not an attribute, it is an element.

Try getText()

Thanks Thomas I changed to getText and it worked…