- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有没有办法让 pywinauto
找到一个只有部分标题的窗口?
这是我的代码:
import pywinauto
pwa_app = pywinauto.application.Application()
w_handle = pywinauto.findwindows.find_windows(title=u'Minitab Professional 5.1 64bit - 3333348.temp.project',
class_name='Window')[0]
问题是每次我打开软件时 temp.project
之前的数字都会改变,因此我无法让 pywinauto
找到正确的窗口。
最佳答案
通过浏览 google code 上的源代码,我看到你可以为标题提供一个正则表达式:
#=========================================================================
def find_windows(class_name = None,
class_name_re = None,
parent = None,
process = None,
title = None,
title_re = None,
top_level_only = True,
visible_only = True,
enabled_only = False,
best_match = None,
handle = None,
ctrl_index = None,
predicate_func = None,
active_only = False,
control_id = None,
):
"""Find windows based on criteria passed in
Possible values are:
* **class_name** Windows with this window class
* **class_name_re** Windows whose class match this regular expression
* **parent** Windows that are children of this
* **process** Windows running in this process
* **title** Windows with this Text
* **title_re** Windows whose Text match this regular expression
* **top_level_only** Top level windows only (default=True)
* **visible_only** Visible windows only (default=True)
* **enabled_only** Enabled windows only (default=True)
* **best_match** Windows with a title similar to this
* **handle** The handle of the window to return
* **ctrl_index** The index of the child window to return
* **active_only** Active windows only (default=False)
* **control_id** Windows with this control id
"""
根据我的说法,pywinauto.findwindows.find_windows(title_re = r'Minitab Professional 5.1 64bit*', class_name='Window')[0]
应该可以工作。
关于带有部分标题的 Python pywinauto 搜索窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28216222/
我正在使用 pywinauto 进行自动化单击 DiffDaff 软件上的某个按钮。 我的意图是: 第一步:打开DiffDaff软件 第二步:点击“关于”按钮 from pywinauto.appli
非常直接的问题。 只想按一个键盘键。像输入一样,使用 pywin auto。我不想在任何应用程序窗口的上下文中按下它。 只是键盘键的原始按键,如 a 或 enter 或退格。 最佳答案 只需使用 #
几个月前,我编写了一个 Python GUI 应用程序来读取包含车辆数据的文件。然后它使用 sendkeys 模块在温室气体模型应用程序中输入数据。我已将代码转换为使用 pywinauto 并使用 p
我正在尝试使用 pywinauto 自动化 Visual Basic 应用程序,后端 =“win32”。除了从组合框中选择一项之外,我可以处理所有事情。这个特定的组合框取决于另一个组合框的选择 这是代
我是pywinauto新手,刚开始学习。我在本地 32 位 Windows 7 操作系统中安装了带有 pip 的 pywinauto。所以,我有这个示例代码可以在 chrome 浏览器中打开一个 UR
我正在使用 python 自动化工具 pywinauto 来将字符插入到其他应用程序文本框中。 我发现执行此操作的最佳方法是在复制要插入到剪贴板的文本并将焦点设置到其他应用程序窗口后调用 ctrl+v
全部, 我已经使用“pip install pywinauto”成功安装了 package:pywinauto,但总是失败,为什么?我是这样做的: pip 安装 pywinauto 然后在 windo
我是基于 Windows 桌面的测试自动化的新手,也是 Python 的新手,在花了很多时间之后,pywinauto 变成了使用 Python 进行基于 Windows 的应用程序测试的明显选择。 我
我想在窗口中找到子元素,但只能是某种类型/ 类(class)。 我使用该代码: def get_visible_buttons(window): children = window.Child
我有一个 Jenkins 管道,它在远程服务器中执行一个程序,该服务器使用 pywin 来操作应用程序以进行功能测试。 当我打开远程桌面时,我的应用程序运行良好,但是当我关闭远程桌面并从 Jenkin
我正在尝试使用 pywinauto 在每次更新类文件时自动启动和停止 TomCat。但是,当我尝试运行它时,它会给出以下警告: 用户警告:32 位应用程序应使用 32 位 Python 自动化(您使用
我正在使用 pywinauto 并且我想从其中一个属性中选择文本。但是,我不知道如何访问它。 import pywinauto pwa_app = pywinauto.application.Appl
我正在使用 pywinauto 将文件上传到网络服务器。我使用 Selenium 导航到页面并激活 Windows 资源管理器上传对话框,然后调用 pywinauto 来访问打开的窗口。我已经能够做到
我正在使用具有自定义堆栈面板的 WPF 应用程序,该面板基本上是一个列表。列表中的项目完全相同,因此我无法选择特定文本来唯一标识元素。其他一些值(例如时间)是动态的。 有没有办法让我获取返回的元素列表
我是 python 和 pywinauto 的新手,我需要在运行程序后使用 pywinauto 和 Chrome_widgetWin_1 在 Chrome 中启动演示 - Chrome 启动但只显示一
我正在尝试使用带有 pywinauto 框架的 python 来控制 Windows 媒体播放器。例如,我可以使用 app.WindowsMediaPlayer.MenuSelect("View->G
我尝试让远程桌面窗口保持事件状态,即避免屏幕保护程序和因不活动超时而关闭连接(我不允许配置远程桌面 session 的行为)。 使用 pywinauto 我只意识到连接到应用程序,但现在例如app.C
我正在尝试使用 pywinauto 远程控制有时在启动时显示警告窗口的 Windows 应用程序。 下面的代码标识了窗口,因为它没有菜单。 我想阅读弹出文本以查找短语“请联系您的系统管理员”。在那个弹
目前我正在使用 Pywinauto 和 Behave 来测试桌面应用程序,但我遇到了障碍。在我的自动化中,有一次我需要使用双击,目前我的工作方式是这样的: @step("User selects {r
我试图在 excel 文档中滚动(使用 pywinauto),但它似乎不起作用。 代码: app = Application(backend="uia").connect(process=8876)
我是一名优秀的程序员,十分优秀!