Q:

What is the difference between the isPresent and isDisplayed methods

I just started using Protractor to write tests. I am wondering what the difference is between the isPresent() and isDisplayed() methods.
The API definitions

isPresent
isDisplayed

So... in what cases are they different?

A:

isPresent is true if element exists in a page (in DOM), but can be hidden (display: none in css)
isDisplayed is true only if isPresent is true and element is visible 

A:

isDisplayed resolves to whether the element is visible or not, but throws an exception if it is not in the DOM.
isPresent resolves to whether it is there in the DOM or not, regardless of whether it is actually visible or not. It doesn't throw an exception.
The following code can be used to avoid the exception that isDisplayed throws if the element is not found in the DOM :
function isVisible(e) {
  var deferred = protractor.promise.defer();

  if (e) {
    e.isDisplayed().then(

      // isDisplayed Promise resolved
      function(isDisplayed) {
        deferred.fulfill(isDisplayed);
      },

      // Silencing the error thrown by isDisplayed.
      function(error) {
        deferred.fulfill(false);
      }
    );
  }
  else {
    deferred.reject(new Error('No element passed'));
  }    

  return deferred.promise;
}

Even an object with both the visibility and presence can be passed while resolving, for example :
deferred.fulfill({
  visible: isDisplayed,
  present: true
});

However, this won't work well with expect statements.

A:

IsPresent(): Returns TRUE if element exists in DOM(may or may not be hidden) else returns false
IsDisplayed():

Returns TRUE if element exists in DOM AND is visible.
Returns FALSE if element exists in DOM and is hidden.
Throws exception if element does not exist in the DOM

