Having issues with Protractor unable to locate CKEditor during testing proceedings

When working with Protractor on a non-Angular page, I am trying to locate the CKEditor instance in order to update the data. The following code snippet works in the Chrome console:

CKEDITOR.instances.html_editor.setData("Hello")

However, when I attempt to perform this action in my test script using Protractor, I encounter the following issue:

it('should enter text in editor successfully', function() {

    var composerPage = new ComposerPage();

    browser.executeScript('return window.CKEDITOR');    
    window.CKEDITOR.instances.html_editor.setData( 'Hello' );        

  });

The error message displayed is:

Error: Failed: Cannot read property 'instances' of undefined

I have reviewed a similar question on Stack Overflow here, but it did not provide a solution to my problem.

If anyone has suggestions on how I can properly define the CKEditor instance and update the data, I would greatly appreciate it!

Answer №1

Implement the browser.executeScript() method to update the editor's content:

var content = 'Hello';
browser.executeScript(function (args) {
    window.CKEDITOR.instances.html_editor.setData(args[0]);
}, content); 

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Having trouble locating an element in headless phantomjs 2.1.1 using Selenium 3?

Upon running the code below: System.setProperty("webdriver.chrome.driver", "C:/Softwares/selenium/chromedriver_win32/chromedriver.exe"); WebDriver driver = new ChromeDriver(capability); driver.get("https://facebook.com/"); ...

I am unable to eliminate the parentheses from the URL

I am in need of creating a function that can extract the content inside "()"" from a URL: Despite my efforts, the function I attempted to use did not provide the desired result. Instead of removing the "()" as intended, it encoded the URL into this format ...

Sharing results between promises in AngularJSIn AngularJS, learn how to

I am currently making a GET request to my server, retrieving the response, and storing the value within a $scope.productId userService.get(true) .then(function(res) { $scope.productId = res.user.productid; } }); Next, I need to util ...

There is an issue with the function of elem.autocomplete - it is not recognized

I'm new to Angular.JS and have been struggling for the past 6 hours. I've been working on reading data from an HTTP source and displaying it as an autocomplete feature on the view. Previously, the data was displayed in a select box, but I decide ...

Tips for creating animations with multiple elements that share the same classes

I am trying to create expandable boxes that can open onclick and close again by clicking on the X. The issue I'm facing is that the close jQuery function isn't working. However, my main concern is how to optimize the code so it doesn't becom ...

Angular JS modal form popup is a sleek and user-friendly feature that

When trying to display a modal form popup, I encountered an issue where it was not appearing. Upon inspecting the element, I received an error stating that $(...)modal is not a function. AuthService.createAdmin(data, function (response) { ...

Implementing a nested ng-repeat for organizing limited data

I'm working with a nested ng-repeat setup like this: <div ng-repeat="item_l in list1"> <div ng-repeat="item_f in list2"> {{item_f}} {{item_l}} </div> </div> Currently, this code is producing around 20 results. ...

Having trouble with the Mysqli query not functioning properly in PHP code after being dispatched via Ajax

I am encountering a problem with a specific Myqsli query. $sqlselect = "SELECT visitatori_id FROM visitatori WHERE visitatori_nome='".$nome."' AND visitatori_cognome='".$cognome."' AND visitatori_orastart='".$time."' AND v ...

In jQuery selectors, providing two variables may not yield any results, yet inputting the same string manually produces the desired output

For instance: let a = "1234"; let b = "line1\\\\.5"; Now, this particular code line: "#" + a + b; Produces the following string "#1234line1\\.5" And when I use it in the select ...

Error: Node.js exceeds maximum call stack size while inspecting an objectlogging or debugging

After defining a class as shown below, I encountered an error stating RangeError: Maximum call stack size exceeded when attempting to review the properties of the Object. var Individual = (function () { function Individual(name, age) { this.na ...

What is the method to include a CoffeeScript file in my project?

Currently, I am attempting to follow the steps outlined in this CoffeScript tutorial. After opening the terminal and navigating to the directory where simpleMath.coffee is located, I proceeded to run node and entered var SimpleMath = require('./simpl ...

Error: The 'in' operator cannot be utilized to search for 'length' in the Kendo UI framework

I am encountering an error while using Angular 1.4, jQuery 1.11.3, and the latest Kendo UI. I'm wondering if this issue is a known bug to Telerik. The only Kendo controls present on the page are kendo-multi-select and kendo-date-picker. TypeError: C ...

Attitude: Defiant and Ignoring Authority

So far, no suggestions have been made, indicating that maybe I haven't properly summarized the issue; The problem arises when I absolutely position the section with the class="container" using an additional class or id specific to that <div>. I ...

What are the steps to launch the headless Firefox profile manager? Is it possible to utilize the Firefox profile manager within a

Is it possible to add my existing Firefox profile to the profile manager in a Docker container? I am unable to run the Firefox profile manager in the container. I need this for running Selenium server with a custom profile. The new implementation in Seleni ...

Retrieve an entire item from a single data point

I am currently developing a ticket system and I am looking to implement a feature that allows users to close a ticket, removing it from their account. In my MongoDB array, the structure of the tickets is as follows: { "tickets": [{ &q ...

Configuring headless unit testing with requirejs

Seeking a JavaScript unit testing environment, I feel like I'm on a quest for the Holy Grail. The criteria are as follows: testing Requirejs AMD modules isolating each module by mocking out dependencies ability to test in-browser during development ...

The Div overlay vanishes once the Javascript function is finished running

Initially, take a look at this fiddle: http://jsfiddle.net/ribbs2521/Q7C3m/1/ My attempt to run JS on the fiddle has been unsuccessful, but all my code is present there, so we should be fine. I was creating my own custom image viewer, and everything was ...

selenium fails to input text into a textbox

I'm attempting to automate the login process using Selenium. So far, I have tried: driver.execute_script driver.find_element_by_css_selector driver.find_element_by_xpath . from selenium import webdriver from webdriver_manager import chrome driver = ...

Steps for displaying a JSX component for every element in an array

I have a requirement to display a unique jsx component for each element in an array. import { ListView } from './components'; // Custom component const array = ["item1","item2","item3"]; export default function App ...

The previous and next arrows do not have a looping feature

I have a collection of 10 HTML pages stored in a folder called PROJECTS. Everything is functioning properly, except for the prev and next arrow navigation buttons. The issue arises when navigating to the last page (e.g., projectPage_10.html) from my Projec ...