title: Setting an Angular model using Protractor
body: <p>I'm trying to emulate a user story on my website with Protractor.</p>
  
  <p>The user has to type in an input that uses auto-completion. In real life, the user has to type some text in the input, then select the right proposition with either her mouse or more naturally her downarrow key.</p>
  
  <p>The problem is that I can't seem to simulate that with Protractor. element.sendKeys just does not allow you to do that. I have tried in a dozen different manners and it yields unpredictable results at best.</p>
  
  <p>So I would like to manipulate the ng-model behing my input directly. Is there a way to access the scope of an element from Protractor and call functions/set properties on it?</p>
  
  <p>Here is a simplified version of my problem :</p>
  
  <p>View :</p>
  
  <pre><code>&lt;div ng-controller="MyController"&gt; 
    &lt;input id="my-input" ng-model="myModel"/&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Controller : </p>
  
  <pre><code> myModule.controller('MyController', ['$scope', function($scope){
     $scope.myModel = "";
     //[...]
   }]);
  </code></pre>
  
  <p>e2e Protractor test :</p>
  
  <pre><code>describe("setting myModel to a fixture value", function(){
    it("should set myModel to 'a test value'", function(){
      var myInput = element('my-input');
      // Now what?
    });
  });
  </code></pre>