How to check placeholder text on input field in Protractor?

We're adding some translations to our apps, and I need to make some transports that grab the placeholder text and check that it's loaded correctly.

How to check placeholder text in an input field using a protractor?

+3


source to share


2 answers


As mentioned in the Tractor Driver FAQ , tryelement.getAttribute('value')



+2


source


element(by.model('<modelName>')).getAttribute('placeholder').then(function(element){
    expect(element).toEqual('<expected placeholder txt>');
});

      



This works for me. I have used it with model

, you can use it with any item you are testing.

0


source







All Articles