How to Copy a disabled text


#1

Hi,

May i ask how to copy a disable text number and paste into the Text field?
I use Send Key but it returns “Unable to send keys ‘C’ to object”

Unable to send keys ‘C’ to object ‘Object Repository/Ob_Deposit/Player Deposit Approve/Approve/amount_div’ (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to send keys ‘C’ to object ‘Object Repository/Ob_Deposit/Player Deposit Approve/Approve/amount_div’


#2

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

}


#3

@phtan84sally

Working from your screenshot, the element div.field-value-text--default

  1. is not disabled
  2. does not have a readOnly property or a readonly attribute

because it’s a DIV element. You cannot typically sendKeys to a DIV.

Moreover, a human user has no way to do what you’re trying to do so trying to write automation code to do what a human user cannot do is probably not a good idea. This is a case where you are modifying the AUT[1], for whatever reason (rarely a good idea).

What are you trying to achieve? What human action are you trying to recreate in code?

[1] Advice about modifying the AUT


#4

Thank you.