AutoITV3脚本
ControlFocus("打开", "", "Edit1")
WinWait("[CLASS:#32770]", "", 10)
ControlSetText("打开" ,"", "Edit1", $CmdLine[1])
Sleep(2000)
ControlClick("打开", "","Button1");
编译为exe文件
nightwatch中调用:
let
child_process =
require(
"child_process")
module.
exports = {
/**
* 上传文件
* toastMessage: 提示信息
* isSuccess:期望是否新建成功
* author wsl
*/
uploadfile
:
function (
browser,
fileFullName) {
child_process.
exec(
'start ' +
process.
cwd() +
'
\\
bin
\\
upfile.exe ' +
fileFullName,
function (
error,
stdout,
stderr) {
if (
error !==
null) {
console.
log(
"exec error" +
error);
}
else
console.
log(
"成功");
})
browser.
pause(
2000);
},
/**
* 上传文件, 用<input type="file">标签
*/
uploadfileByInput
:
function (
browser,
fileFullName) {
browser.
setValue(
'input[type="file"]',
fileFullName)
},
}