如何通过pywinauto在窗口的CVirtualGridCtrl控件中获取表中的内容

时间:2017-09-27 15:57:21

标签: ui-automation pywinauto

我正在尝试在GridCtrl控件中获取表的内容,如下面的屏幕截图所示。

enter image description here

我通过spy ++发现包含该表的控件是CVirtualGridCtrl。

enter image description here

但我怎样才能得到表格的内容?

app = pywinauto.Application().Connect(path = "xiadan.exe")
control = app[u'网上股票交易系统5.0'].CVirtualGridCtrl
control.PrintControlIdentifiers()

如果我运行上面的代码,我将得到以下输出:

enter image description here

经过长时间的搜索和测试,我仍然没有任何线索。 有人可以给我一个暗示吗?非常感谢。

编辑: 非常感谢您的快速回复@ vasily-ryabov。我按照你的建议尝试过,遗憾的是没有可识别的控件来获取我想要的数字。

enter image description here

这是否意味着无法获得细胞的内容? 我也尝试右键单击控件,但没有兴趣的快捷操作。

1 个答案:

答案 0 :(得分:1)

您可以尝试使用剪贴板获取网格数据。

control.type_keys('^A^C')
data = pywinauto.clipboard.GetData()