How to verify text field is non editable

How to verify text field is non editable…I want to verify after click of edit, I should not be allowed to change /enter any data

Hi Snehasmita,

Regarding to your question maybe you can try doing this:

WebUI.verifyElementClickable(findTestObject(‘Your test object’))

Or you can observe the element in the inspector, you can look to the element attributes observe if there are any changes when it is enabled or disabled. There are attributes something like disabled=“true” or disabled=“false” or id or class it depends on the attribute. If that happens you can try doing this

WebUI.verifyElementAttributeValue(findTestObject(‘Your test object’), ‘attributeName’, ‘attributeValue’, 30)

Hope that helps :slight_smile:

1 Like

hi,

this should work if object is readOnly true

//set object value as readOnly false

def y = WebUI.executeJavaScript(“return document.getElementsByClassName(‘form-control’)[0].readOnly=false;”, null)

println ("DEBUG readOnly value y "+y)

you can use javascript to find out is object editable or not

def z = WebUI.executeJavaScript(“return document.getElementsByClassName(‘form-control’)[0].readOnly;”, null)

if (z){

println ("DEBUG object is NOT editable "+z)

}

else{

println ("DEBUG object is editable "+z) //z is false so object is editable

}