3

My problem is being unable to enter text in login and password fields in certain page.

I would like to know how to be able to enter text in this situation. I have been able to automate entering text in other pages, so my problem is specific to this certain page.

Background: Using RobotFramework with Selenium2Library to automate tests. The webpage under test is javascript heavy - implemented with GWT using SmartGWT framework.

What I'm doing and getting: I've played with locator a bit, and for the shown example I opened developer tools for chrome, located the field with element inspector and copied it's XPath.

HTML of SUT:

<input type="TEXT" name="username" id="isc_T" handlenativeevents="false" $89="isc_TextItem_1" $9a="$9b" spellcheck="true" oninput="isc_TextItem_1.$43g()" onselect="isc_TextItem_1.$1162()" autocomplete="OFF" class="textItem" style="WIDTH:106px;HEIGHT:12px;" tabindex="1545">

Line in Robotframework: Input Text //*[@id="isc_T"] ${usernam}

Error message in Robotframework: WebDriverException: Message: Element must be user-editable in order to clear it.

I know that the ID:s might change when using GWT, but now I'm testing one version and I'm pretty positive that locator found the right object, but for some reason can not enter the text.

2
  • Well, what if you try to locate element avoiding id? Let's say by xpath.
    – olyv
    Commented Nov 25, 2014 at 7:23
  • I have tried a lot of different ways to locate the item and I've got a feeling that finding element is not a problem, but element not being user-editable ( although it is when manually using the UI ) I'm thinking if maybe some javascript function catches the input or something. The shown way to locate the fields is captured by "copy XPath" from browser, so I would think it points to correct XPath.
    – Timide
    Commented Nov 25, 2014 at 7:38

5 Answers 5

1

Take a more precise look at the error message. It says "Element must be user-editable in order to clear it".

Seems like your issue relates not to "Input Text" keyword but to earlier one which you probably have in your test (like "Clear Element Text" one). Make sure that this keyword has also a valid locator set.

If it doesn't work you have also to make sure that the IDs for HTML-elements on your page are not generated dynamically each time you call the page (just check element's ID after refreshing the page). In this case "ensureDebugId" solution can be helpful. Please refer to official guide in order to see the example of how you can assure that you'll always have "constant" ID for a HTML-element in case of using GWT framework.

1

From my experience with such error messages, I create a wrapper to input the text. It's helpful when input HTML elements have changed eg validation frame that disappears. You can add Clear input at beginning for further improvement.

Input Type Flex
        [Arguments]    ${locator}    ${text}
        [Documentation]    write text letter by letter
        ${items}    Get Length    ${text}
        : FOR    ${item}    IN RANGE    ${items}
        \    Press Key    ${locator}    ${text[${item}]}
0

I just had the same exception, I was trying to input text to grid cell - click was fine, but input text didn't work. Then I realized that after click on the element, the element has changed and new webelement for input appeared. So the input text must have been "redirected" to different xpath. So be careful about the element changes.

0

I had similar problem.
In my case, the problem was with attributes of password field:

<onblur="this.setAttribute('readonly', 'readonly');"
onfocus="this.removeAttribute('readonly'); this.select();"
type="password" id="passInputId" placeholder="Password" readonly="readonly">

As you see, it would be set as read only when not focused. I tried some methods, like getting to login field, press tab to move to next field and type pass, but Press Key also required locations.

I solved it by using "mouse down" function. Looks like it does not directly access the field, and after that field removes the "readonly" attributes and I can "input text" in it.
Good luck !

-1

I had the same error, and for me the following was very useful to use for multi-select field: Mouse Down, then Mouse Up, and in the end Click Element. It helped me to resolve this issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.