Shol Shol -4 years ago 431
AngularJS Question

How can I set data to field with CKEditor in Protractor test?

My issue is that I got message, "element not visible" in protractor when I tried to set data into field with CKEditor.
Application is working with AngularJS.

element(by.model("question.translations[lang.locale].answer")).sendKeys("Test answer e2e!!!");

How can I set (or get) data to field with CKEditor in Protractor test?
HTML code:

<div ng-repeat="lang in languages">
<div class="col-md-4">
<div class="input-icon right">
<div ckeditor="CKoptions" ng-model="question.translations[lang.locale].answer"></div>

When I try this

var value = 'Hello';
browser.executeScript(function (arguments) {
}, value);

I get the error: Failed: unknown error: Cannot read property 'setData' of undefined

Answer Source

I found a solution

browser.switchTo().frame(element(by.css('#cke_editor1 iframe')).click().sendKeys("Test answer e2e"));

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download