Selenium 和 ckEditor

发布于 2024-08-28 13:00:23 字数 95 浏览 2 评论 0原文

有谁知道我如何让 ckEditor 与 Selenium 一起工作。 我无法将焦点移到“html 编辑”字段或更改 html 字段的值。

有人有这方面的经验吗?

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 ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

溺渁∝ 2024-09-04 13:00:23

只是为了完成答案:
我让它工作:
runScript("CKEDITOR.instances['InstanceName'].setData('

testContent

');")
它不适用于 getEval 命令。

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.

|煩躁 2024-09-04 13:00:23

当我对所见即所得编辑器进行测试时,我必须构建自己的机制来在内容领域工作。通常,它涉及必须设置对象的内部 HTML,然后开始使用工具栏中的页面操纵器。

使用 Selenium 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.

拍不死你 2024-09-04 13:00:23

在硒中工作:

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

Working in Selenium:

selenium.runScript("for(var i in CKEDITOR.instances) { var x = CKEDITOR.instances[i]; " + " x.setData('" + texto + "'); }");
佞臣 2024-09-04 13:00:23

我找到了一个对我有用的解决方案。您可以插入 user-extension.js (Options > options > Selenium Core Extension > Browse ),写入以下内容:

 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 
+"');"); 
} 

这将在 Selenium IDE 的命令选项中添加 insertCKEditor 选项。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文