Tips for inputting text into a Slickgrid cell

Currently, I am working on a project involving an AngularJS application with a Slickgrid component. However, I have encountered a challenge when attempting to write a test for it. Despite successfully using Selenium to click on the cells within the grid, the sendkeys function does not input any text despite the cursor blinking within the cell.

Even after trying to record my actions using Selenium IDE, no entries are logged for entering text into the cell.

I attempted to use the JavaScript console in Chrome to manually enter text into a cell but struggled due to my lack of proficiency in JavaScript.

Could someone provide guidance on which JavaScript code can be utilized in the Chrome console to effectively enter text into a SlickGrid cell? Is there a compatibility issue between selenium and SlickGrid?

I am uncertain of the best approach to resolve this issue.

Thank you for your support.

Answer №1

It appears that your question involves two different topics. While I lack experience with Selenium, I can provide insight on the JavaScript aspect.

Without detailed information about your specific setup in SlickGrid, I will offer solutions based on the official SlickGrid: Making it editable example. You could try implementing these methods by utilizing tools like the JavaScript ScratchPad.

I will present two approaches that I have discovered, as I am unsure which one would be suitable for integration into your Selenium environment.


Approach 1 - using the SlickGrid API:

var row = 0;
var cell = 0;
var input_value = 'Your input';

if(grid.canCellBeActive(row, cell)) {
    grid.setActiveCell(row, cell);

    grid.editActiveCell();

    var activeCell = $(grid.getActiveCellNode());
    if(typeof activeCell !== 'undefined') {
        activeCell.children(0).val(input_value);
        grid.gotoCell(row, cell);
    }
}

Approach 2 - by adjusting the data source of your grid:

In this scenario, you will manipulate a JavaScript array containing objects:

var row = 0;
var input_value = 'Your input';

data[row].title = input_value;
grid.invalidateRow(row);
grid.render();

Both methods serve to modify the data in the specified cell. The key distinction lies in relying on the field name property when employing the second method.

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

Javascript Mouse Events Not Functioning Properly with Three.JS Scene Components

Currently feeling quite perplexed (probably due to fatigue from working on this at an inopportune time). I'm in the midst of trying to configure my three.js application to trigger distinct functions based on different mouse events when the cursor hove ...

Using JQuery to make an AJAX request with URL Rest path parameters

Currently, I have a REST service located at /users/{userId}/orders/{orderId} and I am looking to make a call to it using JQuery. Instead of simply concatenating the IDs like this: $.get( 'users/' + 1234 + '/orders/' + 9876, fu ...

What is the reason the useEffect hook does not function properly with a state variable within context?

Check out my code here. I'm trying to display the content of the array testingData, but it's not showing up. If I remove the useEffect hook, it works fine. Can you help me understand why and how to fix it? ...

Strategies for avoiding sudden movements in the navigation bar?

I've encountered a small issue while working on my personal project and I'm seeking some guidance. The technologies I'm using include Bootstrap4, ejs templating engine, and express. In my project, the Navbar display differs based on whether ...

When a function is not in use, the JavaScript array remains empty

I'm struggling with my JavaScript code below: var buffer=new Array(); function fetchData(min,max){ var ajaxReq = new XMLHttpRequest(); ajaxReq.onreadystatechange = function(){ if (ajaxReq.readyState === 4) { if (ajaxReq.status = ...

Using javascript to navigate back to the previous page without redirecting to the main page

When utilizing an iframe, I've implemented a back button that triggers the following JavaScript code when clicked: document.getElementById("myframe").contentWindow.history.go(-1); // back While this works as intended, if there are no previous pa ...

Creating a Wireframe in Three.js Using a RawShaderMaterial with LineSegments

In the midst of my work on a project, I encountered a dilemma with rendering an intricate wireframe using THREE.LineSegments. My objective is to gradually animate the vertices within this LineSegments material (referred to as warehouse in the project), but ...

Using AngularJS to dynamically bind HTML content based on a variable’s value

I am trying to dynamically display an image of a man or a woman on a scene, depending on the gender of the person logged into my website. The ng-bind-html directive is working fine when I define "imageToLoad" statically. However, it fails when I try to gen ...

What is causing the Unhandled Promise Rejection error when using await with Promise.all?

This is the general setup of my code: (async () => { try { const asyncTasks = [] for (let i = 0; i < 3; i++) { await new Promise((resolve, reject) => setTimeout(resolve, 1000)) for (let j = 0; j < 3; j++) { async ...

When the boolean in RxJS skipWhile remains true

My current scenario involves a specific use-case: There is a service that queues calculation tasks assigned with a certain ID. I have set up an observable to monitor the status of the service. When the ID is still in the queue, the query result is true (i ...

Maintaining duplicate values in a JSON stringify operation: Tips for retention

Server responses are being received in JSON format, which may contain objects with duplicate keys. When displaying the results, I noticed that only the last value for duplicate keys was showing up. After investigating, I realized this was due to using the ...

Can a custom function be executed using setTimeout in Node.js?

I am currently facing an issue with stopping the execution of my code for 2 seconds so that all ongoing animations can finish. I am attempting to implement a delay using setTimeout in Node.js. Here is what I have tried: this.userActivity = function(a,b, ...

oidc-client-js failing to display all profile claims that are supported by oidc-client-js

When setting up UserManager on the oidc-client-ts TypeScript module using the config object below: var config = { authority: "https://localhost:3000", client_id: "js", redirect_uri: "https://localhost:3001/callback.ht ...

Step-by-Step Guide on Retrieving Filtered Data using React Context API

Currently, I am in the process of developing a dashboard application using React.js, React Context API, and ApexCharts. The app will visualize a 1000-length JSON data on 7-8 different charts, along with 6-7 variable filters. Overview of the App Structure: ...

Ending all Firefox processes triggered by GeckoDriver and Selenium in Python: A step-by-step guide

My setup includes python 3.7, selenium, geckodriver.exe, and Firefox 70.0.1x64. I am aware that driver.quit() can be used to close the Firefox window, but in certain situations, I encounter issues with completely quitting Firefox. Below is a snippet of my ...

Leverage Vue3's v-html feature without the need for additional wrapping tags by using script

Is it possible to use Vue's v-html directive within a Vue 3 <script setup> setup without needing an additional wrapping tag? I am looking to achieve something similar to the following: <script setup> const html = ref(`<pre></pre& ...

Looking for someone who has successfully upgraded React Native code from version 0.59 to the most recent version

Is there a way to make my React Native project compatible with the latest version? I am facing a challenge in updating an old React Native project running on version 0.59.10 to the most recent version. Despite trying various methods, I have been unable to ...

Transforming all commas to plus signs in a JavaScript codebase for the entirety of

Currently, I am using winston for logging and have created a common method to log throughout the project. However, I am facing an issue with many logging statements that look like this: logger.info("here is the data" , data) The problem arises when trying ...

Is it possible to redirect the client to a different HTML file after they input a number?

Following a submission of numerical input, I am looking to navigate from the index.html file to another HTML file or similar destination. Could someone provide assistance? Below is the code I have written: <!DOCTYPE html> <html lang="en&quo ...

Creating a sliding menu using React and Headless UI (with Tailwind CSS)

Currently, I'm in the process of developing a slide-over navigation bar or slide menu that features panels opening on top of each other (I'm still searching for the most accurate way to describe it). The main concept revolves around having a sli ...