Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot select item in ListBox #1374

Open
lucasrantunes opened this issue Jan 31, 2024 · 0 comments
Open

Cannot select item in ListBox #1374

lucasrantunes opened this issue Jan 31, 2024 · 0 comments

Comments

@lucasrantunes
Copy link

lucasrantunes commented Jan 31, 2024

Expected Behavior

In Power BI, when I click in the "Publish" button, I have a screen with a ListBox. I want to select an specific item in this ListBox.
image

Control Identifiers:

Dialog - 'Publish to Power BI' (L341, T244, R939, B740)
['Publish to Power BI', 'Dialog', 'Publish to Power BIDialog', 'Publish to Power BI0', 'Publish to Power BI1']
child_window(title="Publish to Power BI", auto_id="KoPublishToGroupDialog", control_type="Window")
...
| | | | | | | | | | ListBox - '' (L373, T370, R909, B546)
| | | | | | | | | | ['My workspaceListBox', 'ListBox']
| | | | | | | | | | |
| | | | | | | | | | | DataItem - 'My workspace' (L373, T370, R892, B402)
| | | | | | | | | | | ['DataItem', 'My workspace', 'My workspaceDataItem', 'My workspace0', 'My workspace1', 'DataItem0', 'DataItem1']
| | | | | | | | | | | child_window(title="My workspace", control_type="DataItem")
| | | | | | | | | | | |
| | | | | | | | | | | | Static - 'My workspace' (L381, T370, R457, B402)
| | | | | | | | | | | | ['My workspace2', 'Static4', 'My workspaceStatic']
| | | | | | | | | | | | child_window(title="My workspace", control_type="Text")
| | | | | | | | | | |
...
| | | | | | | | | | |
| | | | | | | | | | | DataItem - 'Faros Migration' (L373, T466, R892, B498)
| | | | | | | | | | | ['Faros MigrationDataItem', 'DataItem4', 'Faros Migration', 'Faros Migration0', 'Faros Migration1']
| | | | | | | | | | | child_window(title="Faros Migration", control_type="DataItem")
| | | | | | | | | | | |
| | | | | | | | | | | | Static - 'Faros Migration' (L381, T466, R464, B498)
| | | | | | | | | | | | ['Faros Migration2', 'Static7', 'Faros MigrationStatic']
| | | | | | | | | | | | child_window(title="Faros Migration", control_type="Text")

Actual Behavior

I cannot select, click or do something similar in the element.

    publish_dialog = win.child_window(auto_id = "KoPublishToGroupDialog")
    publish_dialog.wait('visible', timeout = 20)
    publish_dialog.ListBox["Faros Migration"].click()

AttributeError: 'ListItemWrapper' object has no attribute 'click'

I already tried to select(), invoke() and nothing works. I'm not able to use the element through publish_dialog.child_window(title="Faros Migration", control_type="DataItem") too.

Steps to Reproduce the Problem

  1. Open a report in Power BI
  2. Click on the "Publish Button"
  3. Try to select a listbox item with pywinauto

Short Example of Code to Demonstrate the Problem

    import os
    from pywinauto.application import Application
    from pywinauto import timings
    from time import sleep
    
    PROCNAME = "PBIDesktop.exe"
    WORKBOOK = "workbook.pbix"
    WORKSPACE = "Faros Migration"
    WAIT_TIMEOUT = 60
    
    os.system('start "" "' + WORKBOOK + '"')
    sleep(1)
    app = Application(backend = 'uia').connect(path = PROCNAME)
    win = app.window(title_re = '.*Power BI Desktop')
    timings.after_clickinput_wait = 1
    
    publish = win.child_window(title="Publish", control_type='Button', found_index=0).wait('visible', timeout=WAIT_TIMEOUT)
    publish.click()
    
    publish_dialog = win.child_window(auto_id = "KoPublishToGroupDialog")
    publish_dialog.wait('visible', timeout = WAIT_TIMEOUT)
    
    publish_dialog.ListBox[WORKSPACE].click()

Specifications

  • Pywinauto version: 0.6.8
  • Python version and bitness: 3.11.4
  • Platform and OS: Windows 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant