Posted 3 December 2024, 2:48 am EST - Updated 3 December 2024, 3:20 am EST
Hello , I have an application that is on SpreadJs 17 and i wanted to automate using cypress , however I am haveing some challenges related to that
*Unable to get cell data and sheet data
*Below code is adding another blank excel and accessing that on top of my component of SpreadJS
*If you see below screenshot it shows another BLANK Excel gets added below my excel
**Please help me in understanding why there is another excel and how to fix this issue
**
Attaching code below also cypress logs which tells that it is getting cell data of New Blank excel that is being created
License Key = I have it stored
import * as GC from “@mescius/spread-sheets”;
window[“GC”] = GC;
GC.Spread.Sheets.LicenseKey=SPREADJSKEY
[code] cy.document().then((doc) => {
// Wait for the spread container to be available
cy.get(‘#ss’, { timeout: 10000 }).should(‘exist’); // Waits for the element with ID ‘ss’ to exist
//cy.xpath(“//span[normalize-space()=‘Breaks’]”).click()
cy.wait(4000)
// Now we know the container exists
const spreadContainer = doc.getElementById(“ss”);
cy.log(“Spread Container:”, spreadContainer);
if (spreadContainer) { // Initialize the SpreadJS Workbook const spread = new GC.Spread.Sheets.Workbook(spreadContainer); // Wait for workbook initialization by checking for a valid sheet cy.log(JSON.stringify(spread),"spread stringify") cy.wrap(spread).then(() => { const sheet = spread.getActiveSheet(); expect(sheet).to.not.be.null; cy.log(spread.getSheet(1),"sheet selected") // Access and log cell data const cellData = sheet.getCell(4, 6).text(); cy.log("Active Sheet Name:", sheet.name()); cy.log("sheet Count:", sheet.getSheetCount()); cy.log("Column Count:", sheet.getColumnCount()); cy.log("Cell Data:", cellData); }); } });[/code]