Issue with SpreadJS selenium automation

Posted by: laptop_prosier_0o on 14 November 2022, 8:39 pm EST

  • Posted 14 November 2022, 8:39 pm EST

    I am trying to automate spreadJS application using selenium web driver java. I have found something like this,

    js.executeScript(“var spread = new GcSpread.Sheets.Workbook(document.getElementById(‘ss’));”);

    And I tried the same after launching the browser from eclipse. Do we need to add any JavaScript libraries for this since it is showing the error as GcSpread not defined.

  • Posted 16 November 2022, 7:10 am EST


    The first step in automating SpreadJS with Selenium is to obtain the SpreadJS instance. You could use the findControl method to get the SpreadJS instance.

    For example, to obtain the spread instance, use the following statement:

    // Find the SpreadJS Instance
    js.executeScript("window.spreadInstance = GC.Spread.Sheets.findControl(document.querySelector('div[gcuielement="gcSpread"]'));");

    “GC” is the object imported from “@grapecity/spread-sheets” in this case. GCSpread was used with previous versions of SpreadJS. You should use GC instead of GCSpread. In order to use the findControl method, make sure the “GC” object is visible to the window.

    import * as GC from "@grapecity/spread-sheets"
    window.GC = GC

    You can open the context menu at our hosted Grapecity SpreadJS Designer by referring to the attached file (the GC object is exposed at window at



    Attached File: JAVA

Need extra support?

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

Learn More

Forum Channels