Verify that element is not editable

Hi,
I need to verify that a element on view page is not editable, so i used not clickable function. But on running the test it is returning as element is clickable. Need Help

Verify that Request number is not editable FAILED because (of) Unable to verify object ‘Object Repository/Page_View request/RequestNumber Value’ to be NOT clickable (Root cause: Object ‘Object Repository/Page_View request/RequestNumber Value’ is clickable)

1 Like

“clickable” and “editable” a different things. I think it’s fair to say, regardless of your object’s editability, Katalon is telling you your object is very likely clickable.

As you’ve probably discovered, there is no single test for “editable”, what you can do, is check for any/all of the following:

1 - readonly=“readonly”

2 - the onchange attribute being null

3 - onpaste being null (? I’m not 100% certain about this so test and test the inverse)

4 - sendKeys should fail

5 - Use Robot/Actions to check right-click, paste (should fail)

No, it’s not pretty. :frowning:

@Russ Thomas But all of these will cause the test case to fail. I want it to get passed and i am not sure what to do about the first two. :frowning:

You can use Failure Handling to control how Katalon behaves when tests (steps) fail:

https://docs.katalon.com/display/KD/Failure+handling

try this:
//check if you can set text in the field
boolean notEditable WebUI.setText(findTestObject(‘Object Repository/Page_View request/RequestNumber Value’), “text”, FailureHandling.OPTIONAL )

than check on this boolean according to your tests.

Not able to do, can any one help with custom keywords for this non editable thing?

Hi, I am also facing the same issue. i need to verify some fields are not editable.please help me out.Is there a way through custom keywords…???

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

}

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

}

Pooja wali said:

Hi, I am also facing the same issue. i need to verify some fields are not editable.please help me out.Is there a way through custom keywords…???

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

}

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

}

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

}

Pooja wali said:

Hi, I am also facing the same issue. i need to verify some fields are not editable.please help me out.Is there a way through custom keywords…???

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

}

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) //boolean value is false

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

}

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

}

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

}

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

}

hi, as Udi has typed

boolean notEditable = WebUI.setText(findTestObject(‘Object Repository/withoutSpaces/Page_CURAHealthcareService/input_Username_username’), “John Doe”, FailureHandling.OPTIONAL )

println ("DEBUG boolean value "+notEditable) //prints here false, inputbox is editable

hi, as Udi has typed

boolean notEditable = WebUI.setText(findTestObject(‘Object Repository/withoutSpaces/Page_CURAHealthcareService/input_Username_username’), “John Doe”, FailureHandling.OPTIONAL )

println ("DEBUG boolean value "+notEditable) //prints here false, inputbox