1

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

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.

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.

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 on the working site

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

Using id="ckeditor" works as expected.

Textarea on my site

<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>

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

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.

Here is a screen grab of my local CKEditor textarea that I am attempting to gain focus to My local CKEditor textarea

Community
  • 1
  • 1
EAQA
  • 21
  • 3
  • It doesn't seem to be related to the CKEditor since Selenium can't find the text area. So it's either a timing issue or your editor is in a frame and you need to switch to it. – Florent B. Oct 17 '16 at 19:26
  • CKEditor 8 doesn't exits. That would be the version of some wrapper or anything else, but not CKEditor itself. – AlfonsoML Oct 18 '16 at 20:10
  • I dig some digging and found that 8.1.8 is referring to my Drupal version. I am using Drupal Core's version of CKEditor (4.5.10) I have attached a screen grab of the CKEditor I am attempting to gain focus to. I do not see an extra iFrame (in comparison to the example that is working). So not sure what is preventing textarea focus. Thank you much! – EAQA Oct 20 '16 at 17:59

2 Answers2

4

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.');");
FluffyKitten
  • 13,824
  • 10
  • 39
  • 52
0

i'm using CKeditor 4.4, selenium webdriver in acceptance test.

this works for me. following this

How to fill a rich text editor field for a Codeception Acceptance test

html of page:

<div id="cke_1_contents" class="cke_contents cke_reset">

    <iframe class="cke_wysiwyg_frame cke_reset" frameborder="0" src=""> 

in my test:

$I->fillCkEditorById('1_contents', 'your added content');

USE 1_contents AS A PARAM

Community
  • 1
  • 1