Jump to content
prasadrajassekaran

FileUpload issue

Recommended Posts

prasadrajassekaran

The below AutoIT code works perfectly fine If I try to select file(s) from a folder locally from chrome browser. The same code does not work if the browser is IE11. Not sure why? Any help.

Version: 3.5.4 

$doubleQuotes=""""
$title=WinGetTitle("[ACTIVE]")
WinWaitActive($title)
ControlFocus($title,"","Edit1")
ControlSetText($title,"","Edit1",$CmdLine[1])
Sleep(900)
ControlClick($title,"","Button1")
Sleep(300)
ControlSetText($title,"","Edit1",$doubleQuotes& $CmdLine[2]& $doubleQuotes)
Sleep(300)
ControlClick($title,"","Button1")

Java Code:-

package HybridFrameWork;

import java.io.File;
import java.util.ArrayList;

public class AutoIT {

   public static void Fileselection(String total, String folderpath) throws Throwable {

      ArrayList<String> List = new ArrayList<String>();
      String doublequotes = "\"";
      String Filelist = "";
      String backslash = "\"\"";
      if (folderpath.equalsIgnoreCase("Image")) {
         GlobalVariable.setFileLocation(ReadProperties.GetConfig("ImageFolder"));
      }

      File path = new File(GlobalVariable.getFileLocation());

      File[] files = path.listFiles();
      for (File f : files) {
         List.add(String.valueOf(f.getName()));
      }
      for (int j = 1; j <= Integer.parseInt(total); j++) {

         Filelist = Filelist + backslash + doublequotes + List.get(j - 1) + doublequotes;
      }

      ProcessBuilder build = new ProcessBuilder(ReadProperties.GetConfig("AutoIT.ToSelectFiles"),
            GlobalVariable.getFileLocation(), Filelist);
      build.start();
   }
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×