Python版需要微软基础库支持,需下载安装微软基础库,大约35Mb左右。

微软基础库的安装包:https://pan.baidu.com/s/1xDF0eR8AoQhEFzudgez22w   密码:no8f 

下面的例子SuperXi为你演示如何自动化的去操作记事本这个windows内置的应用程序


示例如下(操作记事本)

import ctypes
from time import sleep
ll = ctypes.cdll.LoadLibrary
lib = ll(
"C:/1/SuperPatrickLibrary.dll")
lib.sendShortCutKeys(
'{Win}r')
lib.sendKeys(
"notepad");
lib.sendShortCutKeys(
"{Return}");
lib.sendKeys(
"欢迎使用来到AutoTestOps测试开发专业网站!!!");
lib.findElement(
"","文件(F)","","MenuItem");
lib.findElement(
"3","保存(S)   Ctrl+S","","MenuItem");
sleep(
1)
lib.sendKeys(
"test.txt");
lib.findElement(
"1","","Button","Button");
lib.findElement(
"CommandButton_6","(Y)","CCPushButton","Button");
lib.findElement(
"","关闭","","Button");


这里需要注意用之前设置下SuperPatrick接口dll的所在路径,各种语言调用SuperPatrick接口都是一样的,非常简单实用. 


SuperXi