采用AutoIt实现文件上传

在非常规的上传界面中,AutoIt可以操作Windows资源管理器实现上传路径的输入。

image

AutoIt中编辑以下脚本,需通过“AutoIt Windows Info”定位资源管理器路径输入位置信息及打开按钮信息。

1 ;ControlFocus("title","text",controlID) Edit1=Edit instance 1
2 ControlFocus("打开", "","Edit1")
3 ; Wait 10 seconds for the Upload window to appear
4 WinWait("[CLASS:#32770]","",10)
5 ; Set the File name text on the Edit field
6 ControlSetText("打开", "", "Edit1", "D:	est.jpeg")
7 Sleep(1000)
8 ControlClick("打开", "", "Button1")
9 ; Click on the Open button

通过”Compile Script to .exe”将脚本转换成对应32 or 64bit操作系统运行的exe程序。

注意:

调用AutoIt生成的exe前请先打开Web上传图片按钮。

原文地址:https://www.cnblogs.com/linkxu1989/p/6637891.html