【问题标题】:Pywinauto Taskbar - Clicking on Further optionsPywinauto 任务栏 - 单击更多选项
【发布时间】:2023-02-10 12:34:39
【问题描述】:

我的任务栏:- enter image description here

单击箭头后的任务栏:-

enter image description here

想做的是,在任务栏中右击某个应用程序后,是否可以再点击更多选项?

到目前为止我的代码:-

from pywinauto import taskbar
taskbar.TaskBar.Button.click_input()
popup_dlg = taskbar.explorer_app.window(class_name='NotifyIconOverflowWindow')
popup_toolbar = popup_dlg.Overflow_Notification_Area
print(popup_toolbar.texts()[1:])
popup_toolbar.button('Honeygain').click_input(button='right')

enter image description here

红色图标是我要在任务栏中打开的应用程序。 红色图标的名称是“用户配置文件尚未准备好听写”。 在我的代码中,我写了右键单击红色图标。 但是会出现更多的选项。

enter image description here

之后,我想点击工具 然后,我想点击转录录音。

控制标识符:-

Toolbar - 'Overflow Notification Area'    (L1416, T835, R1556, B975)
['Overflow Notification Area', 'Overflow Notification AreaToolbar', 'Toolbar']
child_window(title="Overflow Notification Area", class_name="ToolbarWindow32")

【问题讨论】:

  • 你在Windows 7上吗?你也可以添加弹出菜单的dump_tree()吗?
  • 首先,我在 Windows 11 上。你能详细说明什么是转储树吗?
  • dump_tree() 是打印应用程序控件标识符的东西。就像 webelements 的 html 标签一样。或者您必须使用 print_identifiers() 而不是 dump_tree()
  • 我更新了问题。请参阅问题中的 Control_Identifiers

标签: python user-interface automation taskbar pywinauto


【解决方案1】:

我有类似的情况。我正在尝试右键单击“CCleaner”,然后单击“选项”选项。

CCleaner in system tray

我在下面使用这些代码。

from pywinauto.application import Application
from pywinauto import Desktop

dsk = Desktop(backend='uia')
explorer = Application(backend="uia").connect(path="explorer.exe")
sys_tray = explorer.window(class_name="Shell_TrayWnd")

# app_window = sys_tray.child_window(title="insert the name of application").click_input(button='right')

app_window = sys_tray.child_window(title="CCleaner").click_input(button='right')

# dsk.Context.*insertthenameofoption*.click_input()

dsk.Context.Options.click_input()

也许你可以改进我的代码。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-05-10
    • 1970-01-01
    • 1970-01-01
    • 2020-09-23
    • 1970-01-01
    • 2016-08-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多