{"action":"created","issue":{"url":"https://api.github.com/repos/angular/protractor/issues/2532","labels_url":"https://api.github.com/repos/angular/protractor/issues/2532/labels{/name}","comments_url":"https://api.github.com/repos/angular/protractor/issues/2532/comments","events_url":"https://api.github.com/repos/angular/protractor/issues/2532/events","html_url":"https://github.com/angular/protractor/issues/2532","id":108101818,"number":2532,"title":"Strange behavior of ElementArrayFinder#isDisplayed","user":{"login":"stalniy","id":1159966,"avatar_url":"https://avatars.githubusercontent.com/u/1159966?v=3","gravatar_id":"","url":"https://api.github.com/users/stalniy","html_url":"https://github.com/stalniy","followers_url":"https://api.github.com/users/stalniy/followers","following_url":"https://api.github.com/users/stalniy/following{/other_user}","gists_url":"https://api.github.com/users/stalniy/gists{/gist_id}","starred_url":"https://api.github.com/users/stalniy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stalniy/subscriptions","organizations_url":"https://api.github.com/users/stalniy/orgs","repos_url":"https://api.github.com/users/stalniy/repos","events_url":"https://api.github.com/users/stalniy/events{/privacy}","received_events_url":"https://api.github.com/users/stalniy/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/protractor/labels/type:%20discussion","name":"type: discussion","color":"bfe5bf"},{"url":"https://api.github.com/repos/angular/protractor/labels/type:%20feature%20request","name":"type: feature request","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":24,"created_at":"2015-09-24T10:23:51Z","updated_at":"2015-11-02T23:08:02Z","closed_at":null,"body":"If I want to prevent a promise rejection I can't just write `thenCatch` as ElementArrayFinder doesn't have `thenCatch` or `thenFinally` as it actually is not a promise but promise-like:\r\n```js\r\nelement.all(by.repeater('item in items')).isDisplayed().thenCatch(function() {\r\n   return false;\r\n});\r\n// throws exception\r\n```\r\nInstead I'm forced to write:\r\n```js\r\nelement.all(by.repeater('item in items')).isDisplayed().then(null, function() {\r\n   return false;\r\n});\r\n\r\n// or\r\nelement.all(by.repeater('item in items')).isDisplayed().then().thenCatch(function() {\r\n   return false;\r\n});\r\n```\r\nThe same behavior with all methods \r\n```js\r\nvar WEB_ELEMENT_FUNCTIONS = [\r\n  'click', 'sendKeys', 'getTagName', 'getCssValue', 'getAttribute', 'getText',\r\n  'getSize', 'getLocation', 'isEnabled', 'isSelected', 'submit', 'clear',\r\n  'isDisplayed', 'getOuterHtml', 'getInnerHtml', 'getId', 'getRawId'];\r\n```\r\nthe same with `evaluate`. All these methods return promise of primitive value, wrapping them into `ElementArrayFinder` looks incorrect"},"comment":{"url":"https://api.github.com/repos/angular/protractor/issues/comments/153187135","html_url":"https://github.com/angular/protractor/issues/2532#issuecomment-153187135","issue_url":"https://api.github.com/repos/angular/protractor/issues/2532","id":153187135,"user":{"login":"hankduan","id":1059345,"avatar_url":"https://avatars.githubusercontent.com/u/1059345?v=3","gravatar_id":"","url":"https://api.github.com/users/hankduan","html_url":"https://github.com/hankduan","followers_url":"https://api.github.com/users/hankduan/followers","following_url":"https://api.github.com/users/hankduan/following{/other_user}","gists_url":"https://api.github.com/users/hankduan/gists{/gist_id}","starred_url":"https://api.github.com/users/hankduan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hankduan/subscriptions","organizations_url":"https://api.github.com/users/hankduan/orgs","repos_url":"https://api.github.com/users/hankduan/repos","events_url":"https://api.github.com/users/hankduan/events{/privacy}","received_events_url":"https://api.github.com/users/hankduan/received_events","type":"User","site_admin":false},"created_at":"2015-11-02T23:08:02Z","updated_at":"2015-11-02T23:08:02Z","body":"@stalniy ElementFinder contains a number of (related) responsibilities:\r\n1) It must be able to find an element, including nested elements like `element(by.css('foo')).all(by.class('bar')).filter(fn).first()`\r\n2) It must allow users to perform an action on the element (you can argue whether chaining can be allowed once you perform an action -- I'm not sure about this). However, it must sync with Angular before performing an action\r\n3) It should usable within a page object, that is, no request should be fired until user actually performs an action. \r\n\r\nThese are some of the reasons why ElementFinder isn't just a simple webelement. \r\n\r\nNow, you may request that ElementFinder.action should return a plain promise, so that instead of:\r\n```javascript\r\n$('foo').clear().sendKeys('bar'); // This is an ElementFinder\r\n```\r\nYou should do:\r\n```javascript\r\nvar foo = $('foo'); // This is an ElementFinder\r\nfoo.clear(); // This is a Promise\r\nfoo.sendKeys('bar'); // This is a Promise\r\n```\r\n\r\nThis is up for discussion, but I feel like most people would prefer the first example. I could be wrong, so I've changed the label of this issue to 'type: discussion'\r\n\r\n"}}