Selenium and ckEditor

六月ゝ 毕业季﹏ 提交于 2019-12-05 01:00:38

Just for completing the anwser: I got it to work with: runScript("CKEDITOR.instances['InstanceName'].setData('<p>testContent</p>');") It did not work with the getEval command.

When I have had a to test against WYSIWYG editors I have had to build my own mechanism to work in the content area. Normally it involves having to set the inner HTML of object and then start using the page manipulators in the tool bars.

With Selenium 2 you will be able to send keystrokes in so that they work better and a lot easier.

Renato Araujo

Working in Selenium:

selenium.runScript("for(var i in CKEDITOR.instances) { var x = CKEDITOR.instances[i]; " + " x.setData('" + texto + "'); }");

I've found a solution that worked for me. You can insert a user-extension.js (Options > options > Selenium Core Extension > Browse ) writing the following:

 Selenium.prototype.doInsertCKEditor = function(locator,word) 
{ 
    this.doWaitForCondition("var x = Selenium.browserbot.findElementOrNull('//td[@id=\"cke_contents_form \"]');x != null;", "50000"); 
    this.doRunScript("CKEDITOR.instances['"+locator+"'].setData('"+word 
+"');"); 
} 

This will add the insertCKEditor option in the Command options of Selenium IDE.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!