gaozhao1989 / pyjab

Python implementation for Java application UI automation with Java Access Bridge
GNU General Public License v2.0
49 stars 20 forks source link

Get Cell element in Select Cells property #61

Open HuyNguyen7994 opened 2 years ago

HuyNguyen7994 commented 2 years ago

I want to get the elements listed in Select Cells, but JABElement.get_cell method seems to get from Cells, which cannot be interacted with in my case. MicrosoftTeams-image

Originally posted by @HuyNguyen7994 in https://github.com/gaozhao1989/pyjab/issues/57#issuecomment-1204637058

HuyNguyen7994 commented 2 years ago

For same field, elements in Cells property have the depth of 0 and no dimensions, while in Select Cells property they have meaningful depth and dimensions. Yet both find_ and getcell method only return elements in Cells. Elements in Select Cells property (currently inaccessible): image Elements in Cells property (accessible with both find and get_cell): image

HuyNguyen7994 commented 2 years ago

We can reach the element with get_selected_element image image

but this requires the element to be manually selected first image

gaozhao1989 commented 2 years ago

Hi @HuyNguyen7994,

It seems No JAB API can get selected cells in table. you can reference with below functions and check if specific cell is selected or not, then get selected cell

BOOL getAccessibleTableRowSelections(long vmID, AccessibleTable table, jint count, jint *selections);

BOOL getAccessibleTableColumnSelections(long vmID, AccessibleTable table, jint count, jint *selections);
HuyNguyen7994 commented 2 years ago

I was able to grab the element by setting visible=True in get_cell method