如何使用Codeception使用内容填充CKeditor文本区域 [英] How to fill CKeditor textarea with content using codeception

查看:247
本文介绍了如何使用Codeception使用内容填充CKeditor文本区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是对此的后续问题-如何为代码接受测试填充富文本编辑器字段

This is a follow up question to this one -- How to fill a rich text editor field for a Codeception Acceptance test

本文中给出的解决方案可以完美地在在此网站上看到的CKeditor版本4.3.2标准 CKeditor实例,但不幸的是,它无法在我网站自己的4.5.10版CKeditor上运行。

The solution given on this post, works perfectly on CKeditor version 4.3.2 Standard as seen on this site CKeditor instance but unfortunately does not work on my site's own CKeditor which is version 4.5.10.

我的网站的CKeditor出现问题-Webdriver引发错误,找不到 textarea 的name属性。在示例中,使用CKeitor并不是问题,我可以集中精力并将自定义内容添加到文本区域。

Issue with my site's CKeditor - Webdriver throws an error that the name attribute of the textarea is not found. On the example, working CKeitor this is not an issue, I am able to gain focus and add custom content to the textarea.

问题-CKeditor之间有很大区别吗? 4.3.2(有效)和版本4.5.10(无效)是否会导致该解决方案无法正常工作?

Question - is there a big difference between CKeditor 4.3.2 (working) and version 4.5.10 (not working), that would cause this solution not to function?

工作站点上的Textarea

Textarea on the working site

< textarea id = ckeditor style = visibility:hidden; display:none;>< / textarea>

使用 id = ckeditor 可以按预期工作。

我网站上的文本区域

<textarea class="js-text-full text-full form-textarea resize-vertical" data-drupal-selector="edit-field-pck-headline-0-value" aria-describedby="edit-field-pck-headline-0--54Lxz-5-U5g--description" id="edit-field-pck-headline-0-value--im63vH7ew8s" name="field_pck_headline[0][value]" rows="5" cols="60" placeholder="" data-editor-active-text-format="full_html" style="visibility: hidden; display: none;"></textarea>

我正在使用 name = field_pck_headline [0] [value] ,但网络驱动程序找不到此

I am using the name="field_pck_headline[0][value]" but webdriver cant locate this

感谢您对我的版本(4.5.10)的CKeditor文本区域的关注。很高兴提供更多详细信息,让我知道。

Thanks for any help in getting focus to the CKeditor textarea on my version (4.5.10). I am glad to provide more details, let me know.

这是我尝试获取我的本地CKEditor textarea

推荐答案

这对我有用(测试Drupal 7网站):

Here's what worked for me (testing a Drupal 7 site):

$I->executeJS("CKEDITOR.instances['edit-body-und-0-value'].setData('Text entered via Selenium.');");

这篇关于如何使用Codeception使用内容填充CKeditor文本区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆