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 https://www.grapecity.com/spreadjs/designer/index.html).
Attached File: JAVA file.zip