title: Check text in a DOM element using Protractor
body: <p>Here’s what I’m trying to do while testing an Angular app with Protractor. I would like to get a certain element, which is somewhat like this:</p>
  
  <pre><code>&lt;div class="someClass"&gt;
     &lt;p&gt;{{textFromBoundModel}}&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>then get its html, and check whether it contains the text that I expect it to have.</p>
  
  <p>I tried to get this element first by the <code>cssContainingText</code> method, but it didn't quite work (not sure why; maybe because the text within the paragraph is produced dynamically). So now I’m getting this element using just the <code>by.css</code> locator. Next, I'm checking whether it contains the text I’m testing for:</p>
  
  <pre class="lang-js prettyprint-override"><code>// this is Cucumber.js    
  
  this.Then(/^Doing my step"$/, function(callback){
      var el = element(by.css('.someClass'));            
      expect(el).to.contain("some interesting string");
      callback();
   });
  });
  </code></pre>
  
  <p>but this doesn't work. Problem is, <code>el</code> is some kind of a locator object, and I can’t figure out how to get html of the element it found in order to test against this html. Tried .getText(), with no success.</p>
  
  <p>Any suggestions?</p>