Reputation: 1438
We're adding some translations to our applications and I need to make a few protractor tests that grab placeholder text and check that it's being properly loaded.
How do I check the text of the placeholder on an input field using protractor?
Upvotes: 8
Views: 8460
Reputation: 696
element(by.model('<modelName>')).getAttribute('placeholder').then(function(element){
expect(element).toEqual('<expected placeholder txt>');
});
This works for me. I used it with model
, you can use it with any element you are testing.
Upvotes: 2
Reputation: 3731
As mentioned in the Protractor FAQ, try element.getAttribute('value')
Upvotes: 6