我找到了解决这个问题的方法。在第一部分中,我遍历表并检查测试值是否等于每个单元格值。在第二部分中,我使用击键遍历特定的行和列并使用空格并输入击键以勾选复选框。
请注意,此方法仅适用于选中单个复选框。对于多个复选框,将不得不使用击键回溯并重新进行击键遍历。
#1st Part
textValue = "Test Value"
deplTable = get_component('table')
no_of_columns = deplTable.getColumnCount()
no_of_rows = deplTable.getRowCount()
for col in range (no_of_columns):
if ( col == 1 or col == 4 ):
for row in range (no_of_rows):
if ( deplTable.getValueAt( row ,col) == textValue ):
print 'Found at row:',row,' col:',col
#2nd Part
for x in range (row+1) :
keystroke('table', 'Down')
keystroke('table', 'Left')
if ( col > 1 ):
for y in range (col-1) :
keystroke('table', 'Right')
keystroke('table', 'Space')
keystroke('table', 'Enter')