How to add Value in TextArea with CodeMirror

I am trying to add some value in a TextArea from Java to a WebPage, and i am using the following code :

JavascriptExecutor js = driver;

js.executeScript("CodeExpressionMirror.fromTextArea(document.getElementById('textToParse')).setValue(\"" + text + "\");");

The problem is that if the textArea already had some value in it, lets say “Lonndon” , then in my case the above code will override it with the value in setValue, and from the CodeMirror docs i didnt see AddValue method.I have never worked with JavaScript or Web Development before, which makes things a bit more difficult for me.

What you can do is to get the existing value, then set the value to be that existing plus your additional text.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.