Hello Webdriver Group,
Does anyone have advice for how to use selenium 2.0 / webdriver to
enter text in a CodeMirror editor field? The application I'm testing
has just changed some key fields to CodeMirror editors (to satisfy a
requirement for syntax highlighting), and I need to change my
automated test so that it can enter text in those fields.
CodeMirror requires you to set the textarea's "display" style
attribute to to "none," presumably so the underlying html doesn't
interfere with the way the CodeMirror css will render the text. Here's
a link to a sample CodeMirror page with a single text editing field:
http://codemirror.net/demo/theme.html
My first thought was to find the <pre></pre> tags that CodeMirror uses
to store new text, and then sendKeys there. I was able to locate those
successfully (via xpath), but sendKeys failed to enter any text.
My next approach is to try executing the javascript on the page, and
call CodeMirror's setValue method to enter the text. I'm still
fiddling with the syntax of how to execute javascript in selenium 2.0,
but I wanted to ask if anyone else has already done this, and whether
I'm on the right track.
Thanks for reading!
Mike D