{"action":"created","issue":{"url":"https://api.github.com/repos/angular/protractor/issues/1955","labels_url":"https://api.github.com/repos/angular/protractor/issues/1955/labels{/name}","comments_url":"https://api.github.com/repos/angular/protractor/issues/1955/comments","events_url":"https://api.github.com/repos/angular/protractor/issues/1955/events","html_url":"https://github.com/angular/protractor/issues/1955","id":63339461,"number":1955,"title":"getText() not working if text contains newlines and tabs","user":{"login":"mbarker62","id":2657175,"avatar_url":"https://avatars.githubusercontent.com/u/2657175?v=3","gravatar_id":"","url":"https://api.github.com/users/mbarker62","html_url":"https://github.com/mbarker62","followers_url":"https://api.github.com/users/mbarker62/followers","following_url":"https://api.github.com/users/mbarker62/following{/other_user}","gists_url":"https://api.github.com/users/mbarker62/gists{/gist_id}","starred_url":"https://api.github.com/users/mbarker62/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbarker62/subscriptions","organizations_url":"https://api.github.com/users/mbarker62/orgs","repos_url":"https://api.github.com/users/mbarker62/repos","events_url":"https://api.github.com/users/mbarker62/events{/privacy}","received_events_url":"https://api.github.com/users/mbarker62/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/protractor/labels/needs:%20investigation","name":"needs: investigation","color":"207de5"},{"url":"https://api.github.com/repos/angular/protractor/labels/needs:%20more%20info","name":"needs: more info","color":"bfd4f2"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-21T00:45:27Z","updated_at":"2015-03-24T21:42:09Z","closed_at":null,"body":"I'm having issues with getText() when the text contains newlines and tabs.  I'm not in control of the code generating the title string.\r\n\r\n`<div class=\".page-title\">`\r\n`        Domains    `\r\n`</div>`\r\n\r\nHere are my results using elementexplorer.js\r\n```javascript\r\nelement(by.css('.page-title')).getText()\r\n'Domains'\r\n\r\nelement(by.css('.page-title')).getInnerHtml()\r\n'\\n\\t\\t\\tDomains\\n\\t\\t'\r\n```\r\nHere are my results using protractor, getText() returns empty string\r\n```javascript\r\n    it('should have title', function() {\r\n        expect(element(by.css('.page-title')).getText()).toEqual('Domains');\r\n    });\r\n\r\n  1) domains page should have title\r\n   Message:\r\n     Expected '' to equal 'Domains'.\r\n   Stacktrace:\r\n```\r\nHere are my results using protractor, getInnerHtml() returns the whole string with newlines and tabs\r\n```javascript\r\n    it('should have title', function() {\r\n        expect(element(by.css('.page-title')).getInnerHtml()).toEqual('Domains');\r\n    });\r\n\r\n  1) domains page should have title\r\n   Message:\r\n     Expected '\r\n\t\t\tDomains\r\n\t\t' to equal 'Domains'.\r\n   Stacktrace:\r\n```\r\nI suspect that getText() encounters the first newline and terminates the line.  I have a workaround, but I feel it shouldn't be necessary.\r\n```javascript\r\nelement(by.css('div.page-title')).getInnerHtml().then(function(elem) {\r\n            return elem.trim(); \r\n        });\r\n  ```\r\nWhy is there a discrepancy between elementexplorer.js and protractor?"},"comment":{"url":"https://api.github.com/repos/angular/protractor/issues/comments/85705583","html_url":"https://github.com/angular/protractor/issues/1955#issuecomment-85705583","issue_url":"https://api.github.com/repos/angular/protractor/issues/1955","id":85705583,"user":{"login":"mbarker62","id":2657175,"avatar_url":"https://avatars.githubusercontent.com/u/2657175?v=3","gravatar_id":"","url":"https://api.github.com/users/mbarker62","html_url":"https://github.com/mbarker62","followers_url":"https://api.github.com/users/mbarker62/followers","following_url":"https://api.github.com/users/mbarker62/following{/other_user}","gists_url":"https://api.github.com/users/mbarker62/gists{/gist_id}","starred_url":"https://api.github.com/users/mbarker62/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbarker62/subscriptions","organizations_url":"https://api.github.com/users/mbarker62/orgs","repos_url":"https://api.github.com/users/mbarker62/repos","events_url":"https://api.github.com/users/mbarker62/events{/privacy}","received_events_url":"https://api.github.com/users/mbarker62/received_events","type":"User","site_admin":false},"created_at":"2015-03-24T21:42:09Z","updated_at":"2015-03-24T21:42:09Z","body":"I'm using protractor 1.6.1 with both chrome and firefox.  I didn't realize my version of protractor was so far behind, so I upgraded to 2.0.0.  Now all my tests fail with\n\nError while waiting for Protractor to sync with the page: \"angular could not be found on the window\"\n\n\nOn Mar 23, 2015, at 11:37 AM, Julie Ralph <notifications@github.com> wrote:\n\n> Interesting, there should be no discrepancy between elementexplorer and protractor. The behavior of getText is defined by the webdriver spec and implemented by the browser driver (chromedriver, firefoxdriver, etc). Could you share which version of Protractor you're using and which browser you are testing against, so we can try to reproduce?\n> \n> —\n> Reply to this email directly or view it on GitHub.\n> \n\n"}}