Posted 29 April 2022, 7:01 am EST
- Updated 3 October 2022, 9:12 am EST
Hi Adem,
Query: Even on one of your sample pages I’m getting the same issue, it’d worked for me before;
https://www.grapecity.com/spreadjs/demos/showcase/aging-report/purejs
—> You should change the context to purejs in javascript console, and you will be able to access the GC. In the another sample(https://www.grapecity.com/spreadjs/demos/sample/showcase/aging-report/purejs/), there is no iframe and you can directly access GC.
Query: however, now I’m facing a different issue where it says “window.testSpread.getActiveSheet is not a function”
—> We were unable to replicate the issue at our end. Please share a working sample with all the configurations done so that we can investigate it at our end and assist you accordingly.
You could get the spread instance using the findControl method. In the findControl method, we need to pass the host element for the spread. HostElement is the element which is passed in the Workbook constructor when creating the workbook/spreadSheet. SpreadJS provides various methods like fromJSON(), getActiveSheet(), getColumnCount(), etc, that you can use to test various functionality.
You can refer to the following code snippet.
var hostDiv = webDriver.FindElement(By.Id("ss"));
webDriver.ExecuteScript("window.testSpread = new GC.Spread.Sheets.findControl(arguments[0]);", hostDiv);
var value = webDriver.ExecuteScript("return window.testSpread.getActiveSheet().getValue(0,0);");
Assert.AreEqual("1", value);
Please find the attached gif that demonstrate changing the context in console and using findControl method.
Regards
Ankit
