org.openqa.selenium.JavascriptException: javascript error: window.testSpread.getActiveSheet is not a function

43 Views Asked by At

I'm trying to access the spreadjs canvas for one of my automation project with selenium java

This is code snippet I'm using for the same

URL: https://developer.mescius.com/spreadjs/demos/features/table-sheet/overview/purejs

JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("window.testSpread = new GC.Spread.Sheets.findControl(document.querySelector(\"[gcuielement=\'gcWorksheetCanvas\']\"))");
Object value = js.executeScript("return window.testSpread.getActiveSheet().getValue(0,0,);");

Getting the below error while running the code

org.openqa.selenium.JavascriptException: javascript error: window.testSpread.getActiveSheet is not a function
1

There are 1 best solutions below

1
IssamElbaytam On

can you console.log the value of window.testSpread? also, note that findControl is a static function, no "new" spread = GC.Spread.Sheets.findControl(host);