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.
- Use element.clear() – as mentioned this is not a visible element
- 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
- 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?