So I'm trying to get a string value to be returned from the value of an element on the resolution of this promise. I want to pass a raw string value to another function that I'm building inside a protractor test.
This is the element:
<div style='hidden' >
<input id="group-sendgrid-hidden-input" ng-model='groupCode' value='dangyo' >
</div>
I'm looking for a way to get at either the model value or the attribute value (either will work). Model value might even be better.
This is my attempt to resolve the a promise here and return a result:
// first get the element driver object
var groupCode = element(by.id('group-sendgrid-hidden-input'));
// next resolve a promise provided by this element
groupCode.getAttribute('value').then(function(value){
console.log( 'should be a string: ' + value);
return value;
});
Here the console.log( 'should be a string: ' + value);
always returns null
for the value
and nothing I can do seems to resolve this. I'm sure I'm doing something wrong because I am new to protractor and this seems simple. Does anyone else experience this behavior?