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

refreshing information from table cells #27

Closed szczepanR closed 2 years ago

szczepanR commented 2 years ago

Hi Gary, I am in the situation where I need to check live data from the table (i.e. status changing from "processing" to "done"). Currently, I need to reuse functions find_element_by_role("table") and input_status = jqm_table.get_cell(0, 3) in a while loop. Is there a possibility to get current information from the element without a loop?

gaozhao1989 commented 2 years ago

Hi, I'm not understand which you have mentioned "reuse in while loop", do you means you need find the cell element again after edit the cell value? Please try if this works:

cell_el = some_table.get_cell(x,y)
# some action for update cell value
cell_el.set_element_information()
szczepanR commented 2 years ago

hi, thanks for your prompt response. In my scenario, I have a table with cells that their names change dynamically let's say I need to wait until the cell name changes from "processing" to "done". I only need to get the information from the cell. To read the status I use the "while" loop and I have to do the following: cell_el = some_table.get_cell(x,y) cell_el_info = cell_el.get_element_information() cell_el_name= cell_el_info["Name"] The above works correctly. My question is: Why do every time I need to use the following in the loop?: cell_el = some_table.get_cell(x,y) cell_el_info = cell_el.get_element_information()

I would expect that I should use only the following in the loop: cell_el_name= cell_el_info["Name"]

Correct me if I am wrong.

gaozhao1989 commented 2 years ago

The issue you have talk about is the attribute not update after some attribute(like "name") changed, right?

The current func get information bind the attribute of you specific component, but the value of attributes are in dict, will not auto update after the component touched by some action, this is current solution.

So you need set infor before get them when you have change some attributes.

szczepanR commented 2 years ago

The issue you have talk about is the attribute not update after some attribute(like "name") changed, right?

exactly, this is what I mean

thanks for explanation

gaozhao1989 commented 2 years ago

Hi @szczepanR

Let me push some changes to dev branch later about get attributes info.

You may try to get your necessary attribute like this:

some_element = driver.find_element(xxxx)
# directly get name attribute with latest value
some_element.name

# directly get description attribute with latest value
some_element.description

# some other codes
......
gaozhao1989 commented 2 years ago

Add enhancement support in #28

szczepanR commented 2 years ago

Hi Gary, just tested 1.1.2 some_element.name works as expected. I am getting attribute info.