I am using Protractor for a non-Angular page and wanting to find the CKEditor instance on the page to then set data for. I can do this in Chrome console via:
CKEDITOR.instances.html_editor.setData("Hello")
In my test for the page, I have the code below:
it('should enter text in editor successfully', function() {
var composerPage = new ComposerPage();
browser.executeScript('return window.CKEDITOR');
window.CKEDITOR.instances.html_editor.setData( 'Hello' );
});
However, the error returned is:
Error: Failed: Cannot read property 'instances' of undefined
I've already had a look at this Stack Overflow question here: Protractor: How to access global variables that we have inside our application? but didn't really help get me unstuck.
Any suggestions as to how I can define the CKEditor instance and set data would be helpful!