Selenium and ckEditor

喜欢而已 提交于 2019-12-10 00:58:56

问题


Does anybody know How I can get the ckEdtior to work with Selenium. I'm not able to get the focus to the "html edit" field or change the value of the html field.

Does anybody has experience with this ?


回答1:


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.




回答2:


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.




回答3:


Working in Selenium:

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



回答4:


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.



来源:https://stackoverflow.com/questions/2613493/selenium-and-ckeditor

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