10

I am trying to run test cases to perform reset password and I am facing this issue.

WebDriverException Element must be user-editable in order to clear it.

Basically i am accessing the page for entering the new password and doing this:

browser.$("#newPassword").text("password");

where execution of the above line throws the error.

edwinksl
  • 6,569
  • 3
  • 28
  • 34
Immanuel Fredrick
  • 368
  • 2
  • 6
  • 17
  • can you share the code you are using and the url of the page you are testing ? There are workarounds already tried for such exception as http://stackoverflow.com/questions/15360362/clear-date-input-fails-on-chromewebdriver or here http://stackoverflow.com/questions/25290098/element-must-be-user-editable-in-order-to-clear-it-behat – aberna Feb 25 '15 at 07:52
  • Well what kind of element is it? An `input`? – Arran Feb 25 '15 at 23:01
  • Yes it is an input element of type password – Immanuel Fredrick Feb 26 '15 at 05:58
  • 2
    Hi, The issue got solved. The issue was because i had two ids in same name and it took the first id which was not an editable element. Thanks for the response – Immanuel Fredrick Feb 27 '15 at 12:25
  • Hi, I am getting the same error on type `button` element i.e., `.setValue('div#newOrUsed>button', 'New')` – narainsagar Mar 16 '16 at 10:51

4 Answers4

33

I had the same problem and it was because there was another element with the same id which was not an input field so it could not be cleared.

mosaad
  • 1,893
  • 4
  • 20
  • 46
  • 1
    Kinda the same for me, i had a bad xpath expression. This put me on the right track though, thanks. – Jonathan Sep 17 '18 at 13:11
2

We can try the following:

WebElement.sendKeys(Keys.DELETE);
WebElement.sendKeys("Test");
edwinksl
  • 6,569
  • 3
  • 28
  • 34
Mohd Yusuf
  • 21
  • 3
1

It might be a case of using the wrong method for the input type.

In CodeCeption at least, fillField should be used on input elements and selectOption should be used on select elements and mixing them up will give invalid element state: Element must be user-editable in order to clear it.

tschumann
  • 1,326
  • 2
  • 12
  • 28
0

I had this problem with a Primefaces autoComplete element. Primefaces 6.0 renders a span with the ID you pass, and within that an input with a "_input" appended to the ID. If you just use the ID you added in your source code, you tell Selenium to enter into the span (which fails with the "element must be user-editable" error). Add the "_input" to the ID if you select by ID in selenium.

Robert
  • 4,805
  • 16
  • 34
  • 46