简体   繁体   English

是否可以从 Pane 控件类型读取数据?

[英]Is it possible to read data from Pane control type?

I've started using FlaUI for Automating my thick client .net application.我已经开始使用 FlaUI 来自动化我的胖客户端 .net 应用程序。 The application is Windows Form based.该应用程序基于 Windows 窗体。 The start was good and Login Form was identified and I could Login, but after that came the dead end and I found that almost everything in the application is developed as Pane control type.开始是好的,登录表单被识别,我可以登录,但之后就走到了死胡同,我发现应用程序中的几乎所有东西都是作为窗格控件类型开发的。

So, there is grid, table etc. but they all just appear as Pane type when I see the object hierarchy using Inspect.exe or FLAUInspect tools.因此,有网格、表格等,但当我使用 Inspect.exe 或 FLAUInspect 工具查看对象层次结构时,它们都仅显示为窗格类型。 And nothing really appears in thier property, so it seems that nothing could be read.并且他们的财产中没有真正出现任何内容,因此似乎无法读取任何内容。 But before giving up I just wanted to check with experienced audience on this forum if there is really any way to get the data from Pane objects.但在放弃之前,我只是想在这个论坛上与有经验的观众核实是否真的有任何方法可以从 Pane 对象中获取数据。

Please suggest if there is any way, even that means using other libraries like UIAutomation, TestStack.White, etc.请建议是否有任何方法,即使这意味着使用其他库,如 UIAutomation、TestStack.White 等。

UPDATE: I now understand little more about this.更新:我现在对此了解不多。 So, the objects that are there in the pane are developed in syncfusion and devexpress.因此,窗格中的对象是在 syncfusion 和 devexpress 中开发的。 Is it possible to identify objects developed in syncfusion and devexpress using FlaUI or UIAutomation or TestStack.White, etc ?是否可以使用 FlaUI 或 UIAutomation 或 TestStack.White 等识别在 syncfusion 和 devexpress 中开发的对象?

I don't know if you have already tried the following steps.不知道您是否已经尝试过以下步骤。 Have you add automationId's to your objects in xaml code with:您是否在 xaml 代码中向您的对象添加了自动化 ID:

AutomationProperties.AutomationId="AnyID"

In the testcode, first initialize the main window of the application.在测试代​​码中,首先初始化应用程序的主窗口。

MainWindow = fApplication.GetMainWindow(fAutomation, null)?.AsWindow()

After that you can find your objects by the automationId's, like:之后,您可以通过自动化 ID 找到您的对象,例如:

MainWindow .FindFirstDescendant(cf => cf.ByAutomationId(AnyID))

I did it this way, and don't have to know the hierarchy of my application.我是这样做的,不必知道我的应用程序的层次结构。 Maybe this will work?也许这会奏效?

Most UI Frameworks nowadays fully support UI Automation.现在大多数 UI 框架都完全支持 UI 自动化。 So first make sure that you have a recent version of your framework (syncfusion, devexpress).所以首先确保你有一个最新版本的框架(syncfusion、devexpress)。 In addition, some frameworks provide settings to enable UI Automation.此外,一些框架提供了启用 UI 自动化的设置。 Like for devexpress, you need to set像 devexpress 一样,你需要设置

ClearAutomationEventsHelper.IsEnabled = false;

at the start of your application to test so it exposes way more things (like tabs) to FlaUI.在您的应用程序开始时进行测试,以便它向 FlaUI 公开更多内容(如选项卡)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM