3

I am trying to write simple e2e test, using angular, karma and protractor. I figure out that I can get the text from some element using getText() but I can't find the right way to get the value of input. The sample of my code below:

this.page =  $('.content-area');
this.userEmail = this.page.element(by.css('.email > input'));

this.expectHomeEmail = function(text) {
            expect(this.userEmail.isDisplayed()).toBeTrue();
            expect(this.userEmail.getValue()).toBe(text);
};

The error that I get looks like:

  • TypeError: undefined is not a function

Thanks a lot!

Daria
  • 276
  • 1
  • 3
  • 13
  • Possible duplicate of [Angular testing: Protractor can't get input value](http://stackoverflow.com/questions/19538185/angular-testing-protractor-cant-get-input-value) – Michael Radionov Oct 01 '15 at 08:44
  • 1
    Possible duplicate of [How to getText on an input in protractor](http://stackoverflow.com/questions/20310442/how-to-gettext-on-an-input-in-protractor) – giri-sh Oct 01 '15 at 08:44

1 Answers1

3

Try this :

this.userEmail.getAttribute('value')
Magus
  • 14,796
  • 3
  • 36
  • 51