当前位置:网站首页>【WebDriver】使用AutoIt上传文件
【WebDriver】使用AutoIt上传文件
2022-06-29 17:33:00 【bobob_】
一、AutoIt用于Windows GUI(图形化界面)中进行自动化操作。
官方网站:https://www.autoitscript.com/site/
编辑要操作的windows 脚本

点击捕捉元素

找到元素

通过上面两个图AutoIt Windows Info中Control页面 获得以下信息。
窗口的title为“文件上传”,标题的Class为“#32770”。
文件名输入框的class 为“Edit”,Instance为“1” ,ClassnameNN为“Edit1”。
打开按钮的class 为“Button”,Instance为“1” ,ClassnameNN为“Button1”。
3、打开SciTE Script Editor编辑器,编写脚本。
SciTE Script Editor编辑器如下图:

ControlFocus("打开", "", "Edit1")
WinWait("[CLASS:#32770]","",3)
ControlSetText("打开","","Edit1","C:\DuBo\Desktop\TestData3.pdf")
Sleep(2000) ;等待2秒钟
ControlClick("打开","","Button1")
4、将脚本保存为uploadFile.au3,然后保持uploadFile.html的上传文件窗口处于打开状态,再通过通过Run Script 工具将uploadFile.au3打开运行

5.通过自动化测试脚本调用upfile.exe程序实现上传
public class UploadFile {
public static void main(String[] args) {
.........
try {
String str = "E://uploadFile.exe";
rn.exec(str);
} catch (Exception e) {
System.out.println("Error to run the exe");
}
}
}
边栏推荐
- 关于KALI使用xshell连接
- Younger sister Juan takes you to learn JDBC - 2-day dash Day1
- The R language uses the KAP function (kap.2.raters function) of epidisplay package to calculate the value of kappa statistics (total consistency, expected consistency), analyze the consistency of the
- C language practice ---- pointer string and linked list
- 一次采集JSON解析错误的修复
- mysql支持外键吗
- 传承中华美德,关注中老年大健康,育润奶粉敬老情浓
- Summary of problems during xampp Apache installation
- Does MySQL support foreign keys
- Bottom level internal skill cultivation
猜你喜欢
随机推荐
基于STM32F103ZET6库函数串口实验
正则表达式
基于gis三维可视化的智慧城市行业运用
Multi mode concurrent implementation of tortoise and rabbit race in go language
How to create and delete MySQL triggers
腾讯云发布自动化交付和运维产品Orbit,推动企业应用全面云原生化
反射
R language ggplot2 visualization: use the patchwork package (directly use the plus sign +) to horizontally combine a ggplot2 visualization result and a plot function visualization result to form the f
Master slave replication of MySQL
一次采集JSON解析错误的修复
Leetcode daily question - 535 Encryption and decryption of tinyurl
R语言使用glm函数构建泊松对数线性回归模型处理三维列联表数据构建饱和模型、使用exp函数和coef函数获取模型所有变量的事件密度比(Incidence Density Ratio,IDR)并解读
Subgraphs in slam
What is the function of MySQL cursors
0 basic self-study STM32 (wildfire) - register lit LED
自定義HandlerInterceptor攔截器實現用戶鑒權
Redis 原理 - Sorted Set (ZSet)
The R language inputs the distance matrix to the hclust function for hierarchical clustering analysis. The method parameter specifies the distance calculation method between two combined data points,
【现代信号处理第六次作业】
Redis principle - sorted set (Zset)
![[the sixth operation of modern signal processing]](/img/49/7844a00077e56fd4d73e3ba515f8a6.png)






