コード例 #1
0
        internal void UploadFileToWorkSample()
        {
            string FilePath = Base.WorkSampleFile;

            Console.WriteLine("FilePath = " + FilePath);
            if (GlobalDefinitions.IsWindows())
            {
                //System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
                //Info.FileName = GlobalDefinitions.GetCodeDirectory() + @"..\..\FileUpload.exe";
                //try
                //{
                //    System.Diagnostics.Process.Start(Info);
                //}
                //catch (System.ComponentModel.Win32Exception e)
                //{
                //    Console.WriteLine("Can not find the exe", e.Message);
                //}
                //Thread.Sleep(10000);
                string WindowTitle = "Open";
                AutoItX.WinActivate(WindowTitle, "");
                AutoItX.ControlFocus(WindowTitle, "", "Edit1");
                //AutoItX.ControlSetText(WindowTitle, "", "Edit1", FilePath);
                AutoItX.Sleep(5000);
                AutoItX.Send(FilePath);
                AutoItX.Sleep(5000);
                AutoItX.ControlClick(WindowTitle, "", "Button1");
                Thread.Sleep(5000);
            }
            else
            {
                GlobalDefinitions.wait(5);
                WorSamplesFileElement.SendKeys(FilePath);
                GlobalDefinitions.wait(5);
            }
        }