How to input text to HTML CodeMirror

Hi all,
I want to input html code to CodeMirror as below. Could you please let me know how to input html code?
Thanks,

`<div class="CodeMirror-scroll" tabindex="-1">
<div class="CodeMirror-sizer" style="margin-left: 30px; margin-bottom: -17px; border-right-width: 13px; min-height: 29px; padding-right: 0px; padding-bottom: 0px;">
	<div style="position: relative; top: 0px;">
		<div class="CodeMirror-lines">
			<div style="position: relative; outline: none;">
				<div class="CodeMirror-measure">
					<pre>
						<span>xxxxxxxxxx</span>
					</pre>
				</div>
				<div class="CodeMirror-measure"></div>
				<div style="position: relative; z-index: 1;"></div>
				<div class="CodeMirror-cursors" style="visibility: hidden;">
					<div class="CodeMirror-cursor" style="left: 27px; top: 0px; height: 21px;">&nbsp;</div>
				</div>
				<div class="CodeMirror-code">
					<div style="position: relative;">
						<div class="CodeMirror-gutter-wrapper" style="left: -30px;">
							<div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div>
						</div>
						<pre class=" CodeMirror-line ">
							<span style="padding-right: 0.1px;">abc</span>
						</pre>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<div style="position: absolute; height: 13px; width: 1px; border-bottom: 0px solid transparent; top: 29px;"></div><div class="CodeMirror-gutters" style="height: 42px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div>`

Hello vnduc74

I am pretty sure that Katalon does not have built in keyword for doing that. You can always use JS to set the required value. You could try something like this:
WebUI.executeJavaScript("var editor = CodeMirror.fromTextArea(document.getElementById(\"synonyms\")); editor.setValue(\"var x=15;\")",null);

Where “synonyms” is the id of CodeMirror element and “var x=15;” is the new content that you want to input.

I hope this is somewhat helpful

Best regards
Ismar

2 Likes

Thanks Ismar!

Thanks Ismar!
Duc