如何使用AutoIt上传多个文件?

时间:2016-07-21 11:43:15

标签: java eclipse selenium-webdriver autoit

我正在使用以下代码:

ControlFocus("File Upload","","File1")
ControlSetText("File Upload","","File1",'"C:\Users\Desktop\image1.png" "C:\Users\Desktop\image1.png" "C:\Users\Desktop\image2.png" "C:\Users\Desktop\image3.png" "C:\Users\Desktop\image4.png" "C:\Users\Desktop\image5.png" "C:\Users\Desktop\image6.png" "C:\Users\Desktop\image7.png" "C:\Users\Desktop\image8.png" "C:\Users\Desktop\image9.png"')
ControlClick("File Upload","","Button1")

我已经运行了这些代码文件,但没有存储。输入手动存储的文件

问题是什么。如果有人帮我请。

2 个答案:

答案 0 :(得分:1)

如何自动化窗口的示例如下所示。要将内容保存到文件,首先需要打开它。

var autoit = new AutoItX3Lib.AutoItX3();
var windowWait = autoit.WinWaitActive("[CLASS:#32770]", "", 10);

Console.WriteLine("...Surviving the IE security window handler");
//  autoit.WinWaitActive("Beveiligingswaarschuwing", "Ja");

autoit.ControlSend("Beveiligingswaarschuwing", "", "", "{TAB}");

autoit.Sleep(500);
autoit.ControlSend("Beveiligingswaarschuwing", "", "", "{ENTER}");

autoit.Sleep(500);
autoit.ControlSend("Beveiligingswaarschuwing", "", "", "{TAB}");

autoit.Sleep(500);
autoit.ControlSend("Beveiligingswaarschuwing", "", "", "{ENTER}");

autoit.Sleep(500);
autoit.ControlSend("Beveiligingswaarschuwing", "", "", "{TAB}");

autoit.Sleep(500);
autoit.ControlSend("Beveiligingswaarschuwing", "", "", "{ENTER}");


autoit.Sleep(500);
autoit.ControlSend("Beveiligingswaarschuwing", "", "", "{TAB}");


autoit.Sleep(500);
autoit.ControlSend("Beveiligingswaarschuwing", "", "", "{ENTER}");

image1

image2

答案 1 :(得分:1)

使用AutoIt上传多个文件的代码

    ControlFocus("Open","","Edit1")
    ControlSetText("Open","","Edit1","""C:\Users\Public\Pictures\Sample Pictures\Koala.jpg""""C:\Users\Public\Pictures\Sample Pictures\Hydrangeas.jpg""")
    ControlClick("Open","","Button1")