运行 python 脚本以在最小化的 VM 中安装应用程序时出错

时间:2021-05-12 09:38:11

标签: python automation scripting keyboard-events

我正在使用 python 自动化在 VM 中安装和卸载桌面应用程序。 当我关闭或最小化 VM 时,我的自动化无法运行脚本并因以下错误而失败。

# SendInput() supports all Unicode symbols
num_inserted_events = win32functions.SendInput(len(inputs), ctypes.byref(inputs),  ctypes.sizeof(win32structures.INPUT))
if num_inserted_events != len(inputs):
raise RuntimeError('SendInput() inserted only ' + str(num_inserted_events) +
                               ' out of ' + str(len(inputs)) + ' keyboard events')
           RuntimeError: SendInput() inserted only 0 out of 2 keyboard events
 
 c:\python36\lib\site-packages\pywinauto\keyboard.py:412: RuntimeError

我知道我正在使用键盘事件来执行一些点击,并且只有在虚拟机桌面打开时才能完成。 即使 VM 已关闭或最小化,我能否获得比执行点击事件更佳的选择

0 个答案:

没有答案
相关问题