title: how to select a text range in CKEDITOR programatically?
body: <h1>Problem:</h1>
  
  <p>I have a CKEditor instance in my javascript:</p>
  
  <pre><code>var editor = CKEDITOR.instances["id_corpo"];
  </code></pre>
  
  <p>and I need to insert some text programatically, and select some text range afterwards.</p>
  
  <p>I already did insert text through</p>
  
  <pre><code>editor.insertHtml('&lt;h1 id="myheader"&gt;This is a foobar header&lt;/h1&gt;');
  </code></pre>
  
  <p>But I need to select (highlight) the word "foobar", programatically through javascript, so that I can use selenium to work out some functional tests with my CKEditor plugins.</p>
  
  <h2>UPDATE 1:</h2>
  
  <p>I've also tried something like</p>
  
  <pre><code>var selection = editor.getSelection();
  var childs = editor.document.getElementsByTag("p");
  selection.selectElement(childs);
  </code></pre>
  
  <h3>But doesn't work at all!</h3>
  
  <h1>How can I do that?</h1>
  
  <p>I think that</p>
  
  <pre><code>selection.selectRange()
  </code></pre>
  
  <p>could do the job, but I'could not figure out how to use it.
  There are no examples over there :(</p>