yinkaisheng / Python-UIAutomation-for-Windows

🐍Python 3 wrapper of Microsoft UIAutomation. Support UIAutomation for MFC, WindowsForm, WPF, Modern UI(Metro UI), Qt, IE, Firefox, Chrome ...
Apache License 2.0
2.5k stars 477 forks source link

尝试pywinauto和 uiautomation共同使用,在使用SetActive提示ctypes类型错误 #81

Open qdwangjianjun opened 5 years ago

qdwangjianjun commented 5 years ago

在项目中尝试结合pywinauto 一起进行自动化测试,但是只要导入pywinauto, 使用uiautomaiton中的SetActive()方法就提示类型错误。

Traceback (most recent call last): File "D:/python_work/CAS_AutoTest/ut/ut.py", line 41, in auto.WindowControl(searchDepth=1, AutomationId="myMainWindow", RegexName="Login").SetActive() File "D:\Python37-32\lib\site-packages\uiautomation\uiautomation.py", line 6907, in SetActive elif not IsWindowVisible(handle): File "D:\Python37-32\lib\site-packages\uiautomation\uiautomation.py", line 2124, in IsWindowVisible return bool(ctypes.windll.user32.IsWindowVisible(ctypes.c_void_p(handle))) ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type

yinkaisheng commented 5 years ago

和 #65 是一类问题,里面有原因分析。 uiautomation里没有问题,你需要让其他模块作者改下。

qdwangjianjun commented 5 years ago

和 #65 是一类问题,里面有原因分析。 uiautomation里没有问题,你需要让其他模块作者改下。

谢谢