0

I have this text box element.

<input type="text" name="textbox" class="box-input ng-pristine ng-scope md-input ng-empty ng-valid ng-valid-required ng-touched" ng-required="field.required" ng-model="$ctrl.model[field.nameField.uuid]" ng-disabled="::field.readOnly" id="input_15" aria-invalid="false" style="">

In protractor how should I use it to locate the element? I am not quite sure how to use ng-model="$ctrl.model[field.nameField.uuid]"

Ashley
  • 147
  • 2
  • 20

2 Answers2

1

try like this

let input = element(by.model('$ctrl.model[field.nameField.uuid]'));

I suggest to use unique ID if its possible, or some unique class styles leading to single element.

Infern0
  • 2,565
  • 1
  • 8
  • 21
1

If you are using angular 2 or above by model might not work for you, see here.

You could still use the model attribute to identify your element through css like so

$('[ng-model="$ctrl.model[field.nameField.uuid]"]')
    or
element(by.css('[ng-model="$ctrl.model[field.nameField.uuid]"]'))
DublinDev
  • 2,318
  • 2
  • 8
  • 31