title: Protractor - Page object: Failed: is not a function
body: <p>I'm working with Protractor and I create a page object.</p>
  
  <p>This is my page object:</p>
  
  <pre><code>'use strict';
  
  var CreateAgent = function () {
  this.agentEmail = element(by.model('agent.email'));
  this.janrainConsoleAgent = by.xpath(".//*[@value='ccp_agent']");
  this.janrainConsoleAgentManager = by.xpath(".//* .[@value='ccp_agent_manager']");
  this.saveButton = by.className('md-primary md-raised md-button md-ink-ripple');
  
  this.addEmail = function(email){
      this.agentEmail.sendKeys(email);
  };
  
  this.selectRole = function(role){
      switch(role){
          case 'ccp agent':
              this.janrainConsoleAgent.click();
          case 'ccp agent manager':
              this.janrainConsoleAgentManager.click();
          default:
              break;
      }
  };
  
  this.saveAgent = function(){
      this.saveButton.click();
  };
  };
  module.exports = CreateAgent;
  </code></pre>
  
  <p>This functions are calling in a spec</p>
  
  <p>Here is the spec:</p>
  
  <pre><code>var createAgent = require('../page/create_agent_page');
  
   describe('Protractor Demo Janrain - Create Agent', function(){
  
      it('should fill out information to create agent', function(){
  
        createAgent.addEmail('jburquez+auto001@janrain.com');
        browser.sleep(3000);
        createAgent.selectRole('ccp agent manage');
        browser.sleep(3000);
        createAgent.saveAgent();
        browser.sleep(7000);
  
     });
  });
  </code></pre>
  
  <p>but when I execute my test is giving me an error:</p>
  
  <pre><code>Failures:
  1) Protractor Demo Janrain - Create Agent should fill out information  to create agent
  Message:
    Failed: createAgent.addEmail is not a function
  Stack:
    TypeError: createAgent.addEmail is not a function
  </code></pre>
  
  <p>I'm not sure if something is missing in the page object or in other place.</p>
  
  <p>Hope you can help me and thanks.</p>