2015-11-05 125 views
-1

我已經使用Selenium進行網站自動化和測試。我正在尋找一個基於Python的Selenium模塊,它可以讓我在Windows上控制像Paint.exe這樣的標準桌面應用程序來控制它。我需要一種方法來通過Python自動控制點擊和選擇。Python Selenium喜歡桌面應用程序自動化

https://wiki.python.org/moin/PythonTestingToolsTaxonomy列表串。哪一個最好?

+0

桌面應用程序可以與許多GUI框架來寫。您的應用使用哪些應用? MFC?的WinForms? WPF? QT?這對於選擇合適的工具至關重要。 –

+0

桌面應用程序的Selenium-like自動化框架是https://github.com/2gis/Winium.Desktop(它支持WinForms和WPF)。 pywinauto適合原生應用程序:http://pywinauto.github.io/ –

回答

-1

您可以使用PyAutoIt: 這裏是例子:

open notepad 
type some string into notepad, eg: 「hello world」 
close notepad without saving 

https://pypi.python.org/pypi/PyAutoIt/0.3

import autoit 

autoit.run("notepad.exe") 
autoit.win_wait_active("[CLASS:Notepad]", 3) 
autoit.control_send("[CLASS:Notepad]", "Edit1", "hello world{!}") 
autoit.win_close("[CLASS:Notepad]") 
autoit.control_click("[Class:#32770]", "Button2")