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);
actions.moveToElement(locatorElement);
actions.click();
actions.sendKeys(keys);
actions.build().perform();

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.() – 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?



Source link https://sqa.stackexchange.com/questions/31511/how-to-clear-a-non-visible-

LEAVE A REPLY

Please enter your comment!
Please enter your name here