Access value inside Grid of class type "wxWindowNR" using pywinauto

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
(pywinauto.controls.uia_controls — pywinauto 0.6.8 documentation)
- this is a little fragile as it relies on absolute positioning so a
font change could, potentially, break your tests.

···

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|01||9fe7216e2af84edb7e1708d548bdef02|84df9e7fe9f640afb435aaaaaaaaaaaa|1|0|636494902945565829&sdata=MzzNgAjPeKh0NTqq8Eh3lXDX6fsgWT%2Bzg74xY%2BBiwKc%3D&reserved=0&gt;

Is there any way to access values inside a grid table using pywinauto
like cell A2 in above picture

--
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.

When I use print_control_identifiers, it gives the class name of grid as “wxWindowNR” and I am only able to do some basic stuff like drawing outline and Setting focus on A1 cell. Unable to move forward, any way to move focus to its next cell

···

On Friday, December 22, 2017 at 12:46:24 AM UTC-5, Gadget Steve wrote:

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

Amrutha Pobbati wrote:

When I use print_control_identifiers, it gives the class name of grid
as "wxWindowNR" and I am only able to do some basic stuff like drawing
outline and Setting focus on A1 cell. Unable to move forward, any way
to move focus to its next cell

Not directly, of course. That requires modifying the state within the
other application. All you can do is simulate the human: send
right-arrow keystrokes, or whatever key causes the focus to change.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.