Posted 27 February 2024, 3:03 pm EST
We’re working with some UI test automation. If we have a windows handle, how can we find the spread control? We’re using Spread 15.
Forums Home / Spread / Spread for WinForms
Posted by: thomas.rutledge on 27 February 2024, 3:03 pm EST
Posted 27 February 2024, 3:03 pm EST
We’re working with some UI test automation. If we have a windows handle, how can we find the spread control? We’re using Spread 15.
Posted 28 February 2024, 5:09 am EST
Hi Thomas,
You can find the Form control that contains the FpSpread control by using the window handle with the Control’s FromHandle method. After that, you can find the FpSpread control in the Controls collection of the form. The code snippet is provided below:
var formWindow = Control.FromHandle(this.Handle) as Form1; //You can replace "this.Handle" with the Form1 window handle
if (formWindow != null)
{
var spControl = formWindow.Controls.Find("fpSpread1", false);
if (spControl != null)
{
Debug.WriteLine("FpSpread control found...");
}
}
Refer WinHandle.zip for full implementation.
This process is a general way to find a control using its window handle, and it’s not specific to the Spread.NET product. For more information, you can also refer to help links available online, depending on the methods and tools you are using for UI Automation testing in your application.
If you need any further help regarding this issue, we request you provide us with more details about your use-case scenario with a small sample application implementing the same.
Thanks & Regards,
Aastha
Posted 5 March 2024, 8:10 am EST
Thanks for the reply.
Do you have a recommended way to communicate from a separate test automation process to an instance of a spread.net control? The above code only works inside a single process. We’re wondering if there is a better way other than overriding WndProc and creating Application-Defined Messages.
Any insights to how you internally test Spread.NET will help.
Posted 6 March 2024, 7:34 am EST
Hi Thomas,
We are in discussions with the developers regarding this requirement. [Internal Tracking ID: SPNET-34760]
We will update you on this as soon as we hear back from them.
Thanks & Regards,
Aastha
Posted 7 March 2024, 12:34 am EST
Hi Thomas,
Currently, we do not provide support for UI automation testing for FpSpread control via testing tools.
There are no immediate plans to add this support, but we’ll keep you informed if the developers decide to consider it in the future.
Apologies for the inconvenience caused.
Thanks & Regards,
Aastha