On my page there is an editor that a user can type code into. It is not a normal textarea or input field. To send test to the field I use the following and it works:

Actions actions = new Actions(driver);

However, by default the field also contains helper text "Enter your text here..." that gives validation errors if not removed i.e. the helper text is not commented out.

I have tried numerous ways to remove the text but nothing has worked. To make this trickier there is also an autocomplete feature in the editor.

  1. Use element.clear() - as mentioned this is not a visible element
  2. Click backspace multiple times - the autocomplete feature means pressing 100+ times just gives a different sentence. I don't understand why this is happening as when you use
  3. Use actions.keyDown() - this does not accept the argument Keys.RETURN

Because of the validation message it produces it blocks a lot of tests but I'm out of ideas. Anyone have one?

  • can you paste the html code snippet of the page in which you are trying to clear the textbox. – Alok Jan 13 at 3:46
  • if the element is not visible, how can you see the helper text... ' ideally this would have been implemented as a placeholder in the input tag of the element. So your question is a little ambiguous. Please clarify. – Kshetra Mohan Prusty Mar 13 at 15:54
Actions actions = new Actions(driver);
  • can you explain the ModifierKeys.Control part please? – K-8 Jan 12 at 16:46
  • Its just key press events for windows. – ChathuD Jan 13 at 18:48

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.