title: Protractor: custom locators
body: <p>I have this code:</p>
  
  <pre><code>  by.addLocator('Name',
    function(spanText, opt_parentElement) {
      var using = opt_parentElement || document;
      var td = using.querySelectorAll('td');
        return Array.prototype.filter.call(td, function(teg) {
          return teg.getAttribute("Name") === spanText;
        });
    });
  </code></pre>
  
  <p>It's a simple method to search by attribute "Name". But it isn't universal, because it search element with tag <code>td</code>. How I can make it independent of marking?</p>