{"action":"created","issue":{"url":"https://api.github.com/repos/angular/protractor/issues/1920","labels_url":"https://api.github.com/repos/angular/protractor/issues/1920/labels{/name}","comments_url":"https://api.github.com/repos/angular/protractor/issues/1920/comments","events_url":"https://api.github.com/repos/angular/protractor/issues/1920/events","html_url":"https://github.com/angular/protractor/issues/1920","id":60681774,"number":1920,"title":"How to extract only inner text from html tag","user":{"login":"duchoang","id":3921326,"avatar_url":"https://avatars.githubusercontent.com/u/3921326?v=3","gravatar_id":"","url":"https://api.github.com/users/duchoang","html_url":"https://github.com/duchoang","followers_url":"https://api.github.com/users/duchoang/followers","following_url":"https://api.github.com/users/duchoang/following{/other_user}","gists_url":"https://api.github.com/users/duchoang/gists{/gist_id}","starred_url":"https://api.github.com/users/duchoang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duchoang/subscriptions","organizations_url":"https://api.github.com/users/duchoang/orgs","repos_url":"https://api.github.com/users/duchoang/repos","events_url":"https://api.github.com/users/duchoang/events{/privacy}","received_events_url":"https://api.github.com/users/duchoang/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-11T16:01:18Z","updated_at":"2015-03-11T21:12:34Z","closed_at":"2015-03-11T21:12:34Z","body":"For example with the following html code:\r\n```html\r\n<div id=\"content\">\r\n    Content  <span>ABC</span>\r\n</div>\r\n```\r\nI can use getText() to extract the string \"Content ABC\" with the code:\r\n```javascripts\r\nelement(by.id('content')).getText()\r\n```\r\nBut what I want is to extract only the string \"Content\". I know I can wrap the text into another html tag e.g. span to achieve this. But I don't want to touch the view code. I hope I can try to extract the information in the protractor side. Does anyone know how to do that?\r\nThanks.\r\n"},"comment":{"url":"https://api.github.com/repos/angular/protractor/issues/comments/78372899","html_url":"https://github.com/angular/protractor/issues/1920#issuecomment-78372899","issue_url":"https://api.github.com/repos/angular/protractor/issues/1920","id":78372899,"user":{"login":"juliemr","id":2081709,"avatar_url":"https://avatars.githubusercontent.com/u/2081709?v=3","gravatar_id":"","url":"https://api.github.com/users/juliemr","html_url":"https://github.com/juliemr","followers_url":"https://api.github.com/users/juliemr/followers","following_url":"https://api.github.com/users/juliemr/following{/other_user}","gists_url":"https://api.github.com/users/juliemr/gists{/gist_id}","starred_url":"https://api.github.com/users/juliemr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliemr/subscriptions","organizations_url":"https://api.github.com/users/juliemr/orgs","repos_url":"https://api.github.com/users/juliemr/repos","events_url":"https://api.github.com/users/juliemr/events{/privacy}","received_events_url":"https://api.github.com/users/juliemr/received_events","type":"User","site_admin":false},"created_at":"2015-03-11T21:12:34Z","updated_at":"2015-03-11T21:12:34Z","body":"Unfortunately, this is not a supported behavior for WebDriver. You can do `element(by.id('content')).getInnerHTML` to get the whole thing and parse it yourself, if you'd like.\r\n\r\nClosing as a question - Please read the [contributing guidelines](https://github.com/angular/protractor/blob/master/CONTRIBUTING.md#questions); these types of questions are ill-suited for GitHub. Thanks! "}}