How do I fetch the value of a disabled text box for no corresponding attribute available


#1

I need to WB0000036509 from the above, the xpath do not show any attribute holding this value. Please help…


#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

Not sure if it’ll work for your case but i had a similar issue where the get text keyword did not work.

I solved it by using the “Get Attribute” keyword an output the returned value in a variable

The attribute that you want to get is “value”


#4

Thanks for your response Timo & Daniel…
But the value is a hidden one due to ng-model implementation on Angular.

If I use, Value to fetch this…it returns null.

I believe we need to write javascript to return the actual value - WB0000036509 but I do not know how to do it. Any help is appreciated.


#5

can you check what the return value is if you try this js code line in your browser console:

document.getElementById(“selComnId”).value

if you get the text then it should be possible to get the value via the get attribute keyword


#6

Hi,

is there any DOM value for this object? if yes you can try to set this object readOnly= false
def y = WebUI.executeJavaScript(“return document.getElementsByClassName(‘form-control’)[0].readOnly=false;”, null)
println ("DEBUG readOnly value y "+y)

//TODO is it 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)
}