Opened 13 months ago

Closed 4 months ago

Last modified 4 months ago

#14719 closed New Feature (worksforme)

Add "name" attribute to iframe created by plugin "wysiwygarea"

Reported by: Stefan Borchert Owned by:
Priority: Normal Milestone:
Component: General Version: 4.0
Keywords: Cc:

Description

Problem/Motivation

Over at https://www.drupal.org/node/2741945 we had to create a workaround to access the contents of the iframe created by the wysiwygarea plugin using automated tests (with Behat/Mink). Having the name attribute would allow us to simply use switchToIFrame().

Proposed resolution

Add a name attribute to the iframe and use the value of editor.name for the attribute.

Change History (5)

comment:1 Changed 13 months ago by Stefan Borchert

I have created a pull request to add the name: https://github.com/ckeditor/ckeditor-dev/pull/282

comment:2 Changed 11 months ago by Jakub Ś

Status: newconfirmed
Version: 4.5.10 (GitHub - master)4.0

It isn't a big code change and it it allows improving tests in someone’s environment - it sound like a good idea.

comment:3 Changed 4 months ago by Marek Lewandowski

Resolution: worksforme
Status: confirmedclosed

Hi @stBorchert, first thing: thanks for the contirbution!

However it's very easy to access the iframe now, without a name attribute. Just use: document.querySelector( '.cke_editor_' + editor.name + ' iframe.cke_wysiwyg_frame' ).

In example, for our SDK example it would be: document.querySelector( '.cke_editor_editor1 iframe.cke_wysiwyg_frame' ) to get the first editor's iframe.

Since the change is redundant I'm closing the ticket. If you have any troubles let us know, so we can help you.

comment:4 Changed 4 months ago by Stefan Borchert

The main problem here is, Mink can access the iframe by its name only so without the name switchToIframe() is rather useless :/

comment:5 Changed 4 months ago by Marek Lewandowski

I see - it does sound like a design problem in the Mink itself. Selenium exposes a convenient way to traverse DOM using CSS selectors, so it should not be a problem implement this in Mink - so that others will benefit from your work.

Remember that name is not a required attribute for iframe, so one can not rely it's presence.

Note: See TracTickets for help on using tickets.
© 2003 – 2017 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy