yihleego / robotic-process-automation

🤖 Robotic process automation (RPA) for WeChat, WeCom, etc. Support multiple clients and keep the computer unlocked when disconnect from the remote desktop.
MIT License
206 stars 48 forks source link

大佬你好,请问,有时候self.connect(handle)窗口闪一下,没打开,这个有解决的办法吗 #7

Closed sjingsya closed 1 year ago

yihleego commented 1 year ago

请问方便提供一下是哪个软件吗?使用是UiaApp还是AirApp? 如果不方便可以尝试self.connect(handle)后等待一段时间time.sleep(1),然后再调用一次窗口前置方法,即下方if foreground:分支中的代码。

https://github.com/yihleego/robotic-process-automation/blob/d3b089976dbe259268d7a82059cd5a033098d87c/rpa-client/apps/app.py#L277-L304

sjingsya commented 1 year ago

是AirApp,已经解决了,谢谢回复!应该是窗口最小化的原因, self.connect()里面的device.set_foreground()会置顶失败,在airtest.core.api.connect_device前win32gui.ShowWindow(handle, win32con.SW_RESTORE)先把窗口恢复就不会有问题了。