question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to get certain value of cell in a table if the rows are dynamic.

See original GitHub issue

Hi, I am running into a problem which has a table and it contains columns and rows. Number of columns are fixed but number of rows are dynamic. I need to find out certain value of the cell if it is exists.

Name LastName OrderID
smita1
Smita2
Smita3

I need to find out cell value ‘Smita3’ which some times display at row 3 or row 4 or row 5. How can I do that.

I tried following code…

cTable = MyApp1.child_window(title="orderTable",control_type="Table").wrapper_object()
dItem = pywinauto.findwindows.find_windows(title_re ="Name.*",control_type = "DataItem",found_index=0)
nName = int(len(cTable.descendants(title="Name",control_type="DataItem")))
print(nName)
for i in range(nName):
	cell = MyApp1.cTable.dItem
	print (cell.iface_value.CurrentValue)

	i += i+1

when I run this I get following error traceback…

Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 232, in 'calling callback function'
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 138, in enum_window_proc
    if control_type is not None and control_type != element.control_type:
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 235, in control_type
    return self.__get_control_type(full=False)
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 216, in __get_control_type
    remote_mem = RemoteMemoryBlock(self, size=length*2)
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 105, in __init__
    if hex(self.mem_address) == '0xffffffff80000000' or hex(self.mem_address).upper() == '0xFFFFFFFF00000000':
TypeError: 'NoneType' object cannot be interpreted as an integer
Exception ignored in: <function RemoteMemoryBlock.__del__ at 0x0000021C61266AE8>
Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 163, in __del__
    self.CleanUp()
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 140, in CleanUp
    self.CheckGuardSignature()
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 279, in CheckGuardSignature
    ctypes.c_void_p(self.mem_address + self.size),
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 232, in 'calling callback function'
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 138, in enum_window_proc
    if control_type is not None and control_type != element.control_type:
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 235, in control_type
    return self.__get_control_type(full=False)
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 216, in __get_control_type
    remote_mem = RemoteMemoryBlock(self, size=length*2)
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 105, in __init__
    if hex(self.mem_address) == '0xffffffff80000000' or hex(self.mem_address).upper() == '0xFFFFFFFF00000000':
TypeError: 'NoneType' object cannot be interpreted as an integer
Exception ignored in: <function RemoteMemoryBlock.__del__ at 0x0000021C61266AE8>
Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 163, in __del__
    self.CleanUp()
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 140, in CleanUp
    self.CheckGuardSignature()
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 279, in CheckGuardSignature
    ctypes.c_void_p(self.mem_address + self.size),
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 232, in 'calling callback function'
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 138, in enum_window_proc
    if control_type is not None and control_type != element.control_type:
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 235, in control_type
    return self.__get_control_type(full=False)
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 216, in __get_control_type
    remote_mem = RemoteMemoryBlock(self, size=length*2)
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 105, in __init__
    if hex(self.mem_address) == '0xffffffff80000000' or hex(self.mem_address).upper() == '0xFFFFFFFF00000000':
TypeError: 'NoneType' object cannot be interpreted as an integer
Exception ignored in: <function RemoteMemoryBlock.__del__ at 0x0000021C61266AE8>
Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 163, in __del__
    self.CleanUp()
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 140, in CleanUp
    self.CheckGuardSignature()
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 279, in CheckGuardSignature
    ctypes.c_void_p(self.mem_address + self.size),
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 232, in 'calling callback function'
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 138, in enum_window_proc
    if control_type is not None and control_type != element.control_type:
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 235, in control_type
    return self.__get_control_type(full=False)
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 216, in __get_control_type
    remote_mem = RemoteMemoryBlock(self, size=length*2)
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 89, in __init__
    process_id)
pywinauto.remote_memory_block.AccessDenied: ('[WinError 5] Access is denied.process: %d', 14884)
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 232, in 'calling callback function'
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 138, in enum_window_proc
    if control_type is not None and control_type != element.control_type:
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 235, in control_type
    return self.__get_control_type(full=False)
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 216, in __get_control_type
    remote_mem = RemoteMemoryBlock(self, size=length*2)
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 105, in __init__
    if hex(self.mem_address) == '0xffffffff80000000' or hex(self.mem_address).upper() == '0xFFFFFFFF00000000':
TypeError: 'NoneType' object cannot be interpreted as an integer
Exception ignored in: <function RemoteMemoryBlock.__del__ at 0x0000021C61266AE8>
Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 163, in __del__
    self.CleanUp()
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 140, in CleanUp
    self.CheckGuardSignature()
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 279, in CheckGuardSignature
    ctypes.c_void_p(self.mem_address + self.size),
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 232, in 'calling callback function'
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 138, in enum_window_proc
    if control_type is not None and control_type != element.control_type:
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 235, in control_type
    return self.__get_control_type(full=False)
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 216, in __get_control_type
    remote_mem = RemoteMemoryBlock(self, size=length*2)
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 105, in __init__
    if hex(self.mem_address) == '0xffffffff80000000' or hex(self.mem_address).upper() == '0xFFFFFFFF00000000':
TypeError: 'NoneType' object cannot be interpreted as an integer
Exception ignored in: <function RemoteMemoryBlock.__del__ at 0x0000021C61266AE8>
Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 163, in __del__
    self.CleanUp()
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 140, in CleanUp
    self.CheckGuardSignature()
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 279, in CheckGuardSignature
    ctypes.c_void_p(self.mem_address + self.size),
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 232, in 'calling callback function'
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 138, in enum_window_proc
    if control_type is not None and control_type != element.control_type:
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 235, in control_type
    return self.__get_control_type(full=False)
  File "C:\Python37\lib\site-packages\pywinauto\win32_element_info.py", line 216, in __get_control_type
    remote_mem = RemoteMemoryBlock(self, size=length*2)
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 105, in __init__
    if hex(self.mem_address) == '0xffffffff80000000' or hex(self.mem_address).upper() == '0xFFFFFFFF00000000':
TypeError: 'NoneType' object cannot be interpreted as an integer
3
Smita1
Smita1
Smita1
Exception ignored in: <function RemoteMemoryBlock.__del__ at 0x0000021C61266AE8>
Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 163, in __del__
    self.CleanUp()
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 140, in CleanUp
    self.CheckGuardSignature()
  File "C:\Python37\lib\site-packages\pywinauto\remote_memory_block.py", line 279, in CheckGuardSignature
    ctypes.c_void_p(self.mem_address + self.size),
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

Thanks Smita

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
airelilcommented, May 22, 2020

@jjbright , did you try texts method?

A small tip how could you find it. As you can see, pywinauto throws exception about ListItemWrapper that doesn’t have the get_value method. After this, my next step would be having a look at the docs for available methods in this class. Since you’re using the uia backend your destination is ListItemWrapper class in uia_controls module. You can also dig a bit in the code: https://github.com/pywinauto/pywinauto/blob/5fc0a7f05fa626c1830be5ef32878f76bea08f34/pywinauto/controls/uia_controls.py#L698

0reactions
airelilcommented, May 27, 2020

WRT the column name, you might need to have a closer look to the data grid control with inspect.exe and see what’s actually accessible from uia

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get the Dynamic Table cell value on button click
I've a table which is dynamically generated. In its row, I'm placing buttons. On a button click, I'd like to get the particular...
Read more >
Handling Dynamic Web Tables Using Selenium WebDriver
Example: Get all the values of a Dynamic Table ... The number of columns for each row is different. Here row number 1,...
Read more >
How to get the Dynamic Table cell value on button click
I've a table which is dynamically generated. In its row, I'm placing button. for (var i = 0; i < resp.length; i++) {...
Read more >
Dynamic Excel Table Inputs Based on Cell Value - YouTube
In this video we are going to learn how to use the =INDIRECT function to create flexible inputs for Excel Table formulas.
Read more >
Excel Pivot Table Dynamic Data Source Setup Steps
Select any cell in the range of cells · On the keyboard, press Ctlr + A (select All) · Are all the cells...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found