UI自动化Windows用户登录

问题描述 投票:2回答:1

我有一个测试用例,我必须在Windows UI上自动执行用户操作,

The scenario is that windows password has expired, and when user tries to login to the system, the reset password page appears and user inputs new password and login succeeds.

现在我必须通过脚本来做到这一点,

好的是我在机器上运行了一个python服务,如果需要,我可以在登录之前传递命令。

我谷歌搜索了很多但找不到类似的东西。

如果有人能指出我的问题,我会很高兴,

这个UI自动化应该是什么参考点?

python windows powershell ui-automation
1个回答
2
投票

如果您尝试自动化Windows登录UI,我相信它是可能的,但它要求您使用Windows服务来运行您的测试代码。听起来你可能已经这样做了,因为你提到了一个Python服务,你可以使用它来运行命令而没有用户登录到Windows。

无论如何,Windows服务是我知道的唯一方法(不禁用UAC或以其他方式修改默认的Windows安全配置)。

有关指示,请参阅我对这个问题的回答:

UAC and remote control

如果您的Python代码使用Windows服务的特权运行,它应该能够与系统上的任何UI交互(或者至少启动可以与安全UI交互的其他进程),包括Windows登录桌面。

唯一令人头痛的问题是,为了与Winlogon桌面交互,您的测试代码可能需要使用CreateProcessAsUser函数启动一个单独的程序(并将“Winsta0 \ Winlogon”作为桌面参数传递)。不过不确定。

这个答案看起来也可能对您的情况有所帮助:

Running a process at the Windows 7 Welcome Screen

© www.soinside.com 2019 - 2024. All rights reserved.