1

网络视线具有存储文件的存储空间。我的前辈是点击上传按钮使用AppleScript上传文件并使用上传的文件

public select_uploded_image AddContent() throws IOException, InterruptedException {
    String FilePath = "/Users/apple/Documents/360_a.jpg";

    AddVRcontent.click();
    upload.click();
    Thread.sleep(60l);
    Runtime runtime = Runtime.getRuntime();
    String applescriptCommand = "tell app\"System Events\"\n"+
    "keystroke\"G\"using{Command down,Shift down}\n"+
    "delay 2\n"+
    "keystroke\""+FilePath+"\"\n"+
    "delay 1\n"+
    "keystroke return\n"+
    "delay 1\n"+
    "keystroke return\n"+
    "end tell";
    String[]args = {"osascript","-e",applescriptCommand};
    Process process = runtime.exec(args);

    return PageFactory.initElements(driver,select_uploded_image.class); 


}

如果文件已经存在,这将失败

4

0 回答 0