[selenium2]利用AUTOIT上传 下载

来源:互联网 发布:jbf_11sf编程 编辑:程序博客网 时间:2024/05/18 02:36
If $CmdLine[0]<1 Then Exit EndIf
handleUpload($CmdLine[1])

 
Func handleUpload($uploadfile)
 Dim $title="文件上传"
If WinWait($title,"",4) Then
    WinActivate($title)
    Sleep (1000)
    ControlSetText($title,"","Edit1",$uploadfile)  
    ControlClick($title,"","Button1")
Else
    Return False
EndIf

EndFunc


https://www.autoitscript.com/site/autoit/



java

    public void handleUpload(String execute_file,String filepath) {
        
        String cmd = "\"" + execute_file + "\"" + " " + "\"" + filepath + "\""; //with arguments
        
        try {
            Process p = Runtime.getRuntime().exec(cmd);
            p.waitFor(); //wait for the upload.exe to complete
        } catch (Exception e) {
            e.printStackTrace();
        }
    }



0 0
原创粉丝点击