How do I set the value to codeMirror text field through Selenium.
I am able to click on the text field through xpath.
But not able to set a value to it.
I tried using sendKeys()
method, but it's not working.
I also tried first clicking the text field and then using sendkey()
method, still no luck
Following is the xpath
driver.findElement(By.xpath("//html/body/div[2]/div[2]/div/div/div[2]/div/div/div/div/div[1]/div[3]/div/div[5]/div/div[1]/div/div/div/div[3]/div[1]/pre"))
Edit: HTML code is as mentioned below
<div class="CodeMirror-scroll" tabindex="-1" draggable="true">
<div style="position: relative; min-height: 100%;">
<div class="CodeMirror-sizer" style="margin-left: 29px; min-height:75.5px;">
<div style="position: relative; top: 0px;">
<div class="CodeMirror-lines">
<div style="position: relative; outline: medium none;">
<div class="CodeMirror-measure">
<pre>
</div>
<div style="position: relative; z-index: 1; display: none;"></div>
<div style="">
<div style="position: relative;">
<div style="position: relative;">
<div style="position: relative;">
<div style="position: relative;">
<div style="position: relative;">
</div>
<div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 14px;">
</div>
<pre>
tag? selenium isn't used to swap out pieces of tags like that. You could do that with actual js on the page or through js that you load into the seleniumIDE thru Variables/user-extensions.js (standard file name for included js). Without the IDE you need to include the js file.