SpreadJS Automation testing with JavaScript

Posted by: abubakkar.siddique on 19 January 2021, 5:37 am EST

    • Post Options:
    • Link

    Posted 19 January 2021, 5:37 am EST

    Hi,

    I am automating SpreadJS with Selenium and having issues in getting desired cell value (text).

    I also tried in chrome console but it didn’t help me.

    This is what I am doing in chrome console.

    Page I am automating:

    https://www.grapecity.com/spreadjs/demos/sample/showcase/aging-report/purejs/

    
    var hostDiv = document.getElementById("ss");
    window.testSpread = new GC.Spread.Sheets.Workbook(hostDiv);
    var Res = window.testSpread.getActiveSheet().getValue(8,3);
    console.log(Res);
    
    

    Please guide me what I am doing wrong ?

  • Posted 20 January 2021, 4:47 am EST

    Hi,

    The issue in the sample is arising because you are creating a new instance of spread workbook on the same element instead of using the existing instance. You may use the findControl() method to get the existing instance. Please try using the following code and let us know if the issue persists for you:

    var hostDiv = document.getElementById("ss");
    window.testSpread = GC.Spread.Sheets.findControl(hostDiv);
    var Res = window.testSpread.getActiveSheet().getValue(8,3);
    console.log(Res);
    
    

    Regards

    Sharad

  • Posted 20 January 2021, 6:03 am EST

    Thank you for the reply.

    I got the value of the cell.

    One last question:

    Please also let me know how I can search cells by any string or value on the same sheet ?

  • Posted 20 January 2021, 6:16 am EST

    You may refer to the following demo which demonstrates how we could use search feature:

    https://www.grapecity.com/spreadjs/demos/features/workbook/search/purejs

  • Posted 20 January 2021, 10:04 am EST

    Thanks again. it resolved my problem .

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels