How to highlight element in protractor at run time
<p>In my <strong>protractor</strong> framework, I would like to highlight the found element in UI.
I tried with below code and it is working fine if I use <code>locators(id,name,className,linkText,xpath)</code>. When I am using <code>locators (buttonText,repeater,model,binding)</code> below code is not working and throwing "
<strong>Invalid locator</strong>" error.</p>

<p>Instead of "<code>browser.driver.findElement(locator);</code>" this if I use "<code>element(locator);</code>" code is not working and throwing </p>

<blockquote>
  <p>"FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of
  memory"</p>
</blockquote>

<p>Node version---2.15.1</p>

<p>Protractor version ---3.2.2</p>

<p>How I am calling the function:-</p>

<p><code>highlightElement(by.linkText('log In'));</code>---working fine</p>

<p><code>highlightElement(by.buttonText('Place order'));</code>-- Throwing error </p>

<pre><code>highlightElement = function(locator){
                    console.log("highlight--");

                    console.log("locator---:"+locator);
                    var ele = browser.driver.findElement(locator);

                    return browser.driver.executeScript("arguments[0].setAttribute('style', arguments[1]);",ele, "color: Red; border: 2px solid red;").
                        then(function(resp){
                        browser.sleep(2000);
                        return ele;
                    },function(err){
                        console.log("error is :"+err);
                    });


                };
</code></pre>

<p>Please help me is there any other way to highlight the element in protractor.</p>

<p>Regards,</p>

<p>Deepak Kumar Susarla</p>