Пример #1
0
        public static API_GitHub unInstall_TortoiseGit(this API_GitHub gitHub, string msiPath)
        {
            var process       = msiPath.startProcess();
            var guiAutomation = new API_GuiAutomation(process);
            //step 1
            var tortoiseGitSetup = guiAutomation.windows()[0];

            tortoiseGitSetup.button("Next >").mouse().click();
            //step 2
            tortoiseGitSetup = guiAutomation.windows()[0];
            tortoiseGitSetup.button("Remove Installation").mouse().click();
            //step 3
            tortoiseGitSetup = guiAutomation.windows()[0];
            tortoiseGitSetup.button("Remove").mouse().click();
            //step 4
            for (int i = 0; i < 10; i++)
            {
                gitHub.sleep(2000, true);                // wait 2 secs and try again
                tortoiseGitSetup = guiAutomation.windows()[0];
                if (tortoiseGitSetup.button("Next >").isNull())
                {
                    tortoiseGitSetup.button("Finish").mouse().click();
                    break;
                }
            }
            return(gitHub);
        }
Пример #2
0
        public API_GuiAutomation setGuiAutomation()
        {
            "Mapping GuiAutomation Objects".info();
            //var localProcess = Processes.getCurrentProcess();
            //guiAutomation = new API_GuiAutomation(localProcess);
            var ieProcess = Processes.getProcesses()
                            .Where((process) => process.MainWindowTitle.contains("SI Question Pool"))
                            .First();

            guiAutomation = new API_GuiAutomation(ieProcess);
            if (guiAutomation.notNull())
            {
                "got GuiAutomation Object for local Process".info();
            }
            guiAutomationWindow = guiAutomation.windows()[0];
            if (guiAutomationWindow.notNull())
            {
                "got GuiAutomation Window Object for local Process".info();
            }
            else
            {
                "failed to get GuiAutomation Window Object for local Process".error();
            }

            //setGuiAutomationExamGroupBox();
            //if (guiAutomation.isNull() || guiAutomationWindow.isNull() || guiAutomationExamGroupBox.isNull());
            //	"in setGuiAutomation, one of the expected UIAutomation objects could not be calculated".error();
            return(guiAutomation);
        }
        public static Window firstWindow(this API_GuiAutomation guiAutomation)
        {
            guiAutomation.sleep(100);                           // needed on install wizards that change windows quite quickly
            var windows = guiAutomation.windows();

            if (windows.size() > 0)
            {
                return(windows[0]);
            }
            return(null);
        }
Пример #4
0
        public static API_GitHub install_TortoiseGit(this API_GitHub gitHub, string msiPath)
        {
            var process          = msiPath.startProcess();
            var guiAutomation    = new API_GuiAutomation(process);
            var tortoiseGitSetup = guiAutomation.windows()[0];

            //tortoiseGitSetup.bringToFront();
            //step 1
            tortoiseGitSetup.button("Next >").mouse().click();
            //step2
            tortoiseGitSetup = guiAutomation.windows()[0];
            tortoiseGitSetup.radioButton("I accept the terms in the License Agreement").mouse().click();
            tortoiseGitSetup.button("Next >").mouse().click();
            //step3
            tortoiseGitSetup = guiAutomation.windows()[0];
            tortoiseGitSetup.button("Next >").mouse().click();
            //step4
            tortoiseGitSetup = guiAutomation.windows()[0];
            tortoiseGitSetup.button("Next >").mouse().click();
            //step5
            tortoiseGitSetup = guiAutomation.windows()[0];
            tortoiseGitSetup.button("Install").mouse().click();
            //step6
            for (int i = 0; i < 20; i++)
            {
                gitHub.sleep(2000, true);                // wait 2 secs and try again
                tortoiseGitSetup = guiAutomation.windows()[0];
                if (tortoiseGitSetup.button("Next >").isNull())
                {
                    tortoiseGitSetup.button("Finish").mouse().click();
                    break;
                }
            }
            return(gitHub);
        }
Пример #5
0
        public bool install()
        {
            "Installing {0}".info(ToolName);
            startInstaller_FromMsi_Web();
            if (this.Install_Process.notNull())
            {
                var guiAutomation = new API_GuiAutomation(this.Install_Process);

                //step 1
                guiAutomation.windows()[0]
                .button("Next >")
                .mouse().click();
                //step 2
                var acceptTerms = guiAutomation.windows()[0];
                acceptTerms.radioButton("I accept the terms in the License Agreement")
                .mouse().click();
                acceptTerms.button("Next >")
                .mouse().click();
                //step 3
                guiAutomation.windows()[0]
                .button("Next >")
                .mouse().click();
                //step 4
                guiAutomation.windows()[0]
                .button("Install")
                .mouse().click();
                //step5
                for (int i = 0; i < 20; i++)
                {
                    this.sleep(2000, true);                                            // wait 2 secs and try again
                    var tortoiseGitSetup = guiAutomation.windows()[0];
                    if (tortoiseGitSetup.button("Next >").isNull())
                    {
                        tortoiseGitSetup.button("Finish").mouse().click();
                        break;
                    }
                }
            }
            return(isInstalled());
        }
 public API_GUI_Automation_VisualStudio_2010 attach()
 {
     GUI = VS_Process = new API_GuiAutomation("devenv");
     if (VS_Process.TargetProcess.notNull())
     {
         VS_MainWindow = VS_Process.windows()[0];                //MAIN_WINDOW_TITLE);
     }
     else
     {
         start();
     }
     return(this);
 }
 public static Window window(this API_GuiAutomation guiAutomation, string windowName)
 {
     if (guiAutomation.notNull())
     {
         foreach (var window in guiAutomation.windows())
         {
             if (window.Name == windowName)
             {
                 return(window);
             }
         }
     }
     return(null);
 }
Пример #8
0
        public static API_GitHub putty_generateKeys(this API_GitHub gitHub, string keyPassPhrase, string publicKey, string publicKeyForSSH, string privateKey)
        {
            if (publicKey.inValid() || privateKey.inValid() || publicKeyForSSH.inValid())
            {
                "the  publicKey, publicKeyForSSH, privateKey paths needs to be valid".error();
                return(gitHub);
            }
            var puttyGenPath = @"C:\Program Files\TortoiseGit\bin\puttygen.exe";

            if (puttyGenPath.fileExists().isFalse())
            {
                "Error: could not find puttyGen in TortoiseGit folder: {0}".error(puttyGenPath);
                return(gitHub);
            }
            var process        = puttyGenPath.startProcess();
            var puttyGen       = new API_GuiAutomation(process);
            var window         = puttyGen.windows()[0];
            var generateButton = window.button("Generate").click();

            /// lets move the mouse a bit to create some randomness for PuttyGen
            window.mouse();
            generateButton.mouse();
            window.mouse();
            generateButton.mouse();
            window.mouse();
            //once the key is generated we need to put in the passphrase
            if (keyPassPhrase.inValid())
            {
                window.textBox("Key passphrase:").set_Text(keyPassPhrase ?? "");
                window.textBox("Confirm passphrase:").set_Text(keyPassPhrase ?? "");
            }

            //Saving public Key for SSH
            var keyForOpenSSH = window.textBoxes()[0].get_Text();

            keyForOpenSSH.saveAs(publicKeyForSSH);

            //Saving private Key
            window.button("Save private key").mouse().click();
            var warning = puttyGen.window("PuTTYgen Warning");

            if (warning.notNull())
            {
                warning.button("Yes").mouse().click();
            }
            var saveAsWindow = puttyGen.window("Save private key as:");

            saveAsWindow.textBox("File name:").set_Text(privateKey);
            saveAsWindow.button("Save").mouse().click();

            //Saving public Key
            window.button("Save public key").mouse().click();
            warning = puttyGen.window("PuTTYgen Warning");
            if (warning.notNull())
            {
                warning.button("Yes").mouse().click();
            }

            saveAsWindow = puttyGen.window("Save public key as:");
            saveAsWindow.textBox("File name:").set_Text(publicKey);
            saveAsWindow.button("Save").mouse().click();

            process.stop();

            "The keys were saved to {0} and {1}: {0}".info(publicKey, privateKey);

            return(gitHub);
        }