简体   繁体   English

如何使用编码的UI测试获取Wpf DataGrid的全部内容

[英]How do I get the entire contents of a Wpf DataGrid with Coded UI Test

We are automating a WPF application. 我们正在自动化WPF应用程序。 The ui maps turn any DataGrid object we try to target into a WpfControl object. ui映射将我们尝试定位的任何DataGrid对象转换为WpfControl对象。

We are able to explore the children and extract header and cell info from that object. 我们能够探索孩子并从该对象中提取标题和单元格信息。 However only the visible Grid contents are available and that object doesn't have any properties like ScrollIntoView which would aid in consuming the contents that is currently OffScreen. 但是,只有可见的Grid内容可用,并且该对象没有ScrollIntoView类的任何属性,这些属性将有助于使用当前处于OffScreen的内容。

Surely there is a way to consume an entire DataGrid ...??? 当然,有一种方法可以消耗整个DataGrid ... ???

Thanks In Advance, Jeff 预先感谢,杰夫

The way I have done it before is to write a subscript which iterates over each cell using the keyboard, and then gets the data by copying the text to the clipboard and then retrieving it into the program. 我之前做过的方法是编写一个下标,使用键盘在每个单元格上进行迭代,然后通过将文本复制到剪贴板然后将其检索到程序中来获取数据。 I can usually get it to go through 5-10 cells per second, which is not incredibly fast, however it works. 我通常可以使其每秒通过5到10个单元,这虽然不算快,但是可以工作。

I'll get to work tomorrow and I can grab you the code for it if that doesn't make sense. 我明天去上班,如果那没道理,我可以为您获取代码。

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

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