Monday, May 27, 2013

Selenium IDE & CKEditor recording problem

Its been so long and today i planed to write about a problem and a solution i have faced while i try to record with Selenium IDE and CKEditor.

Problem: 
While recording with selenium IDE it can't record the CKEditor text that was written inside the CKEditor text field.

Solution:
Adding these three line will let the Selenium IDE type into the text box.

Here is the table for the IDE:

focus | class=cke_editable cke_editable_themed cke_contents_ltr
typeKeys | class=cke_editable cke_editable_themed cke_contents_ltr | Automated test text from Selenium IDE
runScript | CKEDITOR.instances["edit-body-und-0-value"].setData('Automated test text from Selenium IDE ');



focus | class=cke_editable cke_editable_themed cke_contents_ltr
This is the class of the CKEditor (please see the screenshot below to know how to find the class of CKEditor by using firebug)

Use firebug to know the class of CKEditor
  • typeKeys | class=cke_editable cke_editable_themed cke_contents_ltr | Automated test text from Selenium IDE


  • typeKeys will focus the CKEditor text field. Here the class is the same class used above. And the text after the class will be written inside the text field of CKEditor.



    runScript | CKEDITOR.instances["edit-body-und-0-value"].setData('Automated test text from Selenium IDE ');

    runScript will run the script that will write inside the text field of the CKEditor. 

    This is the screenshot of IDE if you need more help please let me know. 

    Selenium IDE - CKEditor code