noel
noel

Reputation: 21

Unable to select my checkboxes using Pywinauto

I am trying to interact with windows using pywinauto.

This is the output of dump_tree:

   |    |    |    |    |    |    |    | ListBox - 'Team'    (L381, T265, R513, B285)
   |    |    |    |    |    |    |    | ['Team2', 'TeamListBox', 'ListBox']
   |    |    |    |    |    |    |    | child_window(title="Team", control_type="List")
   |    |    |    |    |    |    |    |    | 
   |    |    |    |    |    |    |    |    | CheckBox - 'Team'    (L381, T265, R513, B285)
   |    |    |    |    |    |    |    |    | ['Team3', 'TeamCheckBox', 'CheckBox', 'TeamCheckBox0', 'TeamCheckBox1', 'CheckBox0', 'CheckBox1']
   |    |    |    |    |    |    |    |    | child_window(title="Team", control_type="CheckBox")
   |    |    |    |    |    |    |    |    | 
   |    |    |    |    |    |    |    |    | CheckBox - 'Team'    (L381, T265, R513, B285)
   |    |    |    |    |    |    |    |    | ['Team3', 'TeamCheckBox', 'CheckBox', 'TeamCheckBox0', 'TeamCheckBox1', 'CheckBox0', 'CheckBox1']
   |    |    |    |    |    |    |    |    | child_window(title="Team", control_type="CheckBox")
   |    |    |    |    |    |    |    |    | 
   |    |    |    |    |    |    |    |    | CheckBox - 'Team'    (L381, T265, R513, B285)
   |    |    |    |    |    |    |    |    | ['Team3', 'TeamCheckBox', 'CheckBox', 'TeamCheckBox0', 'TeamCheckBox1', 'CheckBox0', 'CheckBox1']
   |    |    |    |    |    |    |    |    | child_window(title="Team", control_type="CheckBox")
   |    |    |    |    |    |    |    |    | 
   |    |    |    |    |    |    |    |    | CheckBox - 'Team'    (L381, T265, R513, B285)
   |    |    |    |    |    |    |    |    | ['Team3', 'TeamCheckBox', 'CheckBox', 'TeamCheckBox0', 'TeamCheckBox1', 'CheckBox0', 'CheckBox1']
   |    |    |    |    |    |    |    |    | child_window(title="Team", control_type="CheckBox")

But I couldn't select the boxes to check or click.

I have tried to select second checkbox following the doc

print(dlg_spec.TeamListBox.item_count())
dlg_spec.TeamListBox.select(2, select=True)

The output:

26
Traceback (most recent call last):
    dlg_spec.TeamListBox.select(2, select=True)
TypeError: select() got an unexpected keyword argument 'select'

Upvotes: 0

Views: 59

Answers (1)

Vasily Ryabov
Vasily Ryabov

Reputation: 10000

Please use Application(backend="uia") for XAML apps. Also please provide more full code samples to see such things exactly not trying to guess (from previous question code).

Also please read the Getting Started Guide. 2 backends have different hierarchies and even some property names like class_name vs control_type.

Upvotes: 1

Related Questions