{"action":"created","issue":{"url":"https://api.github.com/repos/angular/protractor/issues/4790","repository_url":"https://api.github.com/repos/angular/protractor","labels_url":"https://api.github.com/repos/angular/protractor/issues/4790/labels{/name}","comments_url":"https://api.github.com/repos/angular/protractor/issues/4790/comments","events_url":"https://api.github.com/repos/angular/protractor/issues/4790/events","html_url":"https://github.com/angular/protractor/issues/4790","id":318470804,"number":4790,"title":".clear() seems not clearing when the cursor is in front of the text ","user":{"login":"Tandy1234","id":14115931,"avatar_url":"https://avatars1.githubusercontent.com/u/14115931?v=4","gravatar_id":"","url":"https://api.github.com/users/Tandy1234","html_url":"https://github.com/Tandy1234","followers_url":"https://api.github.com/users/Tandy1234/followers","following_url":"https://api.github.com/users/Tandy1234/following{/other_user}","gists_url":"https://api.github.com/users/Tandy1234/gists{/gist_id}","starred_url":"https://api.github.com/users/Tandy1234/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tandy1234/subscriptions","organizations_url":"https://api.github.com/users/Tandy1234/orgs","repos_url":"https://api.github.com/users/Tandy1234/repos","events_url":"https://api.github.com/users/Tandy1234/events{/privacy}","received_events_url":"https://api.github.com/users/Tandy1234/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-04-27T16:22:15Z","updated_at":"2018-04-27T19:16:38Z","closed_at":null,"author_association":"NONE","body":"Hi there!\r\nI'm not sure if this a bug or intended, please confirm it.\r\n\r\n- Node Version: `8.11.1`\r\n- Protractor Version: `5.1.2`\r\n- Angular Version: `5.1.0`\r\n- Browser(s): `Chrome`\r\n- Operating System and Version `macOS 10.13.2`\r\n\r\nIn my case, I have a html `input` element with its cursor in front of the text. I'm able to do `sendKeys()` with no problems, but `clear()` seems not clearing anything. If I do the same thing with other `input` elements whose cursors are in the end of their text, everything works fine. My code sample is something like this: \r\n```\r\n this.zip = element(by.id('zip')).element(by.css('input'));\r\n await this.zip.clear();\r\n await this.zip.sendKeys(input);\r\n```\r\n`this.zip` is the `input` element with cursor in front of its text\r\nAnd I also notice if I do a `click()` before `clear()`. It does clear the text, but `sendKeys(input)` would put text back.\r\n```\r\n await this.zip.click();\r\n//browser.sleep(2000);\r\n await this.zip.clear();\r\n//browser.sleep(2000);\r\n await this.zip.sendKeys(input);\r\n```\r\nso for example: \r\nif the original text in `zip` is `12345`, and `input` is `6789`, after the above execution, it would show `678912345`. I put `browser.sleep(2000)` in between each method and I can see in the browser, it clear the `zip` field, and when it does `sendKeys(input)`, it puts `6789` in, but for some reason, `12345` comes back.\r\n From what I understanding, the `clear()` function should clear the text regardless of the cursor position. Can someone explain the trick behind it? \r\n\r\nEDIT: \r\nOne thing I forgot to mention, the input element `zip` is a sub-element of `p-inputmask`, which is from PRIMENG. \r\nHere is what it looks like in Chrome.\r\n```\r\n<p-inputmask id=\"zip\" mask=\"?99999-9999999999999\" unmask=\"true\" ng-reflect-disabled=\"false\" ng-reflect-unmask=\"true\" ng-reflect-mask=\"?99999-9999999999999\" ng-reflect-is-disabled=\"false\" class=\"ng-valid ui-inputwrapper-filled ng-touched ng-dirty\" ng-reflect-model=\"928359283592835928\">\r\n    <input pinputtext type=\"text\" class=\"ui-inputtext ui-corner-all ui-state-default ui-widget ui-state-filled\">\r\n</p-inputmask>\r\n```\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/angular/protractor/issues/comments/385068177","html_url":"https://github.com/angular/protractor/issues/4790#issuecomment-385068177","issue_url":"https://api.github.com/repos/angular/protractor/issues/4790","id":385068177,"user":{"login":"Tandy1234","id":14115931,"avatar_url":"https://avatars1.githubusercontent.com/u/14115931?v=4","gravatar_id":"","url":"https://api.github.com/users/Tandy1234","html_url":"https://github.com/Tandy1234","followers_url":"https://api.github.com/users/Tandy1234/followers","following_url":"https://api.github.com/users/Tandy1234/following{/other_user}","gists_url":"https://api.github.com/users/Tandy1234/gists{/gist_id}","starred_url":"https://api.github.com/users/Tandy1234/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tandy1234/subscriptions","organizations_url":"https://api.github.com/users/Tandy1234/orgs","repos_url":"https://api.github.com/users/Tandy1234/repos","events_url":"https://api.github.com/users/Tandy1234/events{/privacy}","received_events_url":"https://api.github.com/users/Tandy1234/received_events","type":"User","site_admin":false},"created_at":"2018-04-27T19:16:38Z","updated_at":"2018-04-27T19:16:38Z","author_association":"NONE","body":"@awarecan  I updated my post. I don't have neither `placeholder` nor `value`.  And I also read some older issues about Angular model updating. https://github.com/angular/protractor/issues/301#issuecomment-32651201\r\nhttps://github.com/angular/protractor/issues/4156\r\nWould that related?  "}}
{"actor":{"display_login":"Tandy1234"}}