I am using Protractor for Automation. I am trying to verify value of element present in the model window. the element is disabled (greyed out) and not present on the DOM. How to get the value of this element?
I tried out Javascript Executor
broswer.executeScript("return arguments[0].value", webElement);
//Failed: javascript error: Cannot read properties of null (reading 'value')webelement.getAttribute('innerHTML')
// Failed: Cannot read property 'getAttribute' of undefinedwebelement.getAttribute('value')
//Failed: Cannot read property 'getAttribute' of undefineddocument.getElementByClass('uk-input uk-margin-remove au-target').value
--//this also gives undefinedWhen we hover on the value it is shown in this below line :
<input disabled="disabled" type="text" class="uk-input uk-margin-remove au-target" value.bind="model.mof.offer_code" au-target-id="2588" placeholder="(Undefined)">
I want to fetch 234218 value from the UI. Is there any way I can get the element value?
run this following javascript,
broswer.executeScript("arguments[0].removeAttribute("disabled")", webElement);
And verify