How to create a basic page in Drupal project using Selenium?

Zyxware default image4

Creating basic page is a general test must be done for all Drupal sites. And you are decided to do this through automated tool Selenium.The problem we face here is that you can't test inserting contents in the CK Editor by record and play. You have to insert Selenium commands for adding contents in the CK editor. Lets see how this can be handled.

For inserting content in CK editor, you have to find the instance of CK editor. This can be done easily using the firebug. Select the CK editor through firebug as shown in the figure.

CKeditor.jpg

The red portion marked in the figure is the id of CK editor which is needed to insert contents in the CK editor. Then you can use the runScript command of Selenium and set the target as


CKEDITOR.instances["edit-body-und-0-value"].setData("Test Data");

Here the instance 'edit-body-und-0-value' is identified through firebug and 'TestData' is the data that should be inserted in the CK editor. Please refer the below image for better understanding.

editor2.jpg

Thus we can easily test creating Drupal basic page through Selenium. By saving this test case you can create multiple pages of different contents and thus saves a lot of testing time.