I am trying to clear text from <div> section using XPath using the below line.

Clear Element Text    xpath=//*[@id="intro-overlay"]/div

I am getting below Error:

InvalidElementStateException: Message: invalid element state: Element must be user-editable in order to clear it.

Can anyone please help me how to fix this.

  • you may need to hack it to be editable before you can clear it. – Yu Zhang Jul 30 at 22:07
  • It is also possible that you improperly located your text field. – Alexey R. Jul 30 at 22:19
  • @Yu Zhang - How can we hack it ? Any examples will be helpful. – qaautomation2018 Jul 30 at 22:40
  • @Alexey - I am logging the variable. I get - "full-height full-width display-flex flex-direction-column align-items-center position-fixed". If I delete this manually, it works. So, I am trying to see how can I edit/delete the text. – qaautomation2018 Jul 30 at 22:42
  • A possible scenario could be the element is being obscured by another when clicking, or perhaps not being visible on the DOM. Check the state of the element at the time of interaction. – Kshetra Mohan Prusty Jul 31 at 5:00

The problem is you are performing the action on wrong element.

<div> tag defines a division or a section in an HTML document. The element is often used as a container for other HTML elements to style them with CSS or to perform certain tasks with JavaScript.

The clear command works on textbox (<input>) or textarea. So make sure you have located the correct textbox for clearing the text

  • Thanks for all your comments. I am not clearing the textbox value. It's part of the HTML div section which has style and I am trying to maipulate/overwrite the style property. – qaautomation2018 Jul 31 at 11:53
  • @qaautomation2018, can you share the exact html code for that element – NarendraR Jul 31 at 11:59
  • This is the HTML section. <div name="fixed-page" class="full-height full-width display-flex flex-direction-column align-items-center position-fixed" style="top: 0px; bottom: 0px; left: 0px; right: 0px; z-index: 9;">. I am trying for this --> <div name="fixed-page" class="full-height full-width display-flex flex-direction-column align-items-center position-fixed" style=""> – qaautomation2018 Jul 31 at 12:35
  • @qaautomation2018, there should be input tag. is it possible to share the url. because the content you have shared is not enough to get the things – NarendraR Jul 31 at 12:38

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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