On 21/12/2017 21:58, Amrutha Pobbati wrote:
> <
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flh3.googleusercontent.com%2F-6P-mNbjfZ7I%2FWjwuSOQvTjI%2FAAAAAAAANA4%2FcyYzgfUJ66864jovpXsgsWzTvieP5e1UgCLcBGAs%2Fs1600%2FCapture2.PNG&data=02%7C01%7C%7C9fe7216e2af84edb7e1708d548bdef02%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636494902945565829&sdata=MzzNgAjPeKh0NTqq8Eh3lXDX6fsgWT%2Bzg74xY%2BBiwKc%3D&reserved=0>
>
> Is there any way to access values inside a grid table using pywinauto
> like cell A2 in above picture
>
I am sure that it is in a couple of ways:
1. Use the print_control_identifiers() to try to identify it
2. Add to your code, (possibly only in test mode), a menu item "Get
Cell Value" that produces a dialogue prompting for the Cell ID and then
a result dialogue with the fetched value and an OK button - you can then
use the menu to produce the first dialogue, type text to enter A2 and
read the contents of the results dialogue.
3. Use the uia_controls ListViewWrapper to select A2, (I would expect
as cell(1, 0) since it is (row, col) indexes), see
http://pywinauto.readthedocs.io/en/latest/code/pywinauto.controls.uia_controls.html?highlight=grid#pywinauto.controls.uia_controls.ListViewWrapper
4. Double Click (Mouse.DoubleClick) on its coordinates and then use
Selected Text
(
http://pywinauto.readthedocs.io/en/latest/code/pywinauto.controls.uia_controls.html?highlight=grid#pywinauto.controls.uia_controls.ListViewWrapper)
- this is a little fragile as it relies on absolute positioning so a
font change could, potentially, break your tests.
--
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect
those of my employer.
---
This email has been checked for viruses by AVG.
http://www.avg.com