public IIdeaProcessManipulator Attach()
 {
     _mainWindow = Application.Attach("idea64")
                   .Find(title => title.Contains("IntelliJ IDEA"), InitializeOption.WithCache);
     _intPtr         = GetDC(IntPtr.Zero);
     _turnedOffPixel = GetPixel(_intPtr, (int)_extractButtonPosition.X, (int)_extractButtonPosition.Y);
     return(this);
 }
Beispiel #2
0
        private static void Main(string[] args)
        {
            //okta-signin-username
            //okta-signin-password
            //okta-signin-submit
            //ZscalerApp

            Process.Start(@"C:\Program Files (x86)\Zscaler\ZSATray\ZSATray.exe");
            Thread.Sleep(5000);
            var process = Process.GetProcessesByName("ZSATray").FirstOrDefault();

            if (process != null)
            {
                var application = Application.Attach(process.Id);
                var window      = application.GetWindow(SearchCriteria.ByAutomationId("ZscalerApp"), InitializeOption.NoCache);

                var userNameTextBox = window.Get <TextBox>(SearchCriteria.ByAutomationId("ZSAUNFUserNameText"));
                var loginButton     = window.Get <Button>(SearchCriteria.ByAutomationId("ZSAUNFLoginButton"));

                userNameTextBox.Text = "";
                loginButton.Click();

                Thread.Sleep(10000);

                AutomationElement username = FindChildElement("okta-signin-username", window.AutomationElement)[0];
                username.SetFocus();
                InsertText(username, "");
                SendKeys.SendWait("");

                AutomationElement password = FindChildElement("okta-signin-password", window.AutomationElement)[0];

                password.SetFocus();
                SendKeys.SendWait("!");

                AutomationElement submit = FindChildElement("okta-signin-submit", window.AutomationElement)[0];
                submit.SetFocus();
                SendKeys.SendWait("{ENTER}");
            }

            Console.ReadKey();
        }
Beispiel #3
0
        //private UTILS _utils = new UTILS();

        // Perry Hunter 06/10/2013
        ///<summary>Selects the specified tab in the AWG Main Window</summary>
        /// <summary>PREREQUISITE: AWG mode is selected</summary>
        ///<param name="tabName">The AutomationID (name) of the tab to select</param>
        public static void SelectMainTabControl(string tabName)
        {
            if (AwgSetupSteps.IgnoreUi)
            {
                return;
            }

            IAWG awg = AwgSetupSteps.GetAWG("1");
            //awg.DiagComment("Selecting the " + tabName + " tab control in " + awg.ModelString + " window");

            //Find the AWG application
            Application application = Application.Attach(AWGUI.ProcessName);

            Assert.IsNotNull(application);

            //Find the main window by it's AutomationID
            Window window = application.GetWindow(awg.ModelString);

            Assert.IsNotNull(window);

            //Find the requested tab by it's AutomationID (in WPF, this is name property)
            var panelMain = (Panel)window.Get(SearchCriteria.ByAutomationId("containerMain"));

            Assert.IsNotNull(panelMain);

            //Our tab isn't really a tab. It's a panel contro
            var tab = (Panel)panelMain.Get(SearchCriteria.ByAutomationId(tabName));

            Assert.IsNotNull(tab);

            //Check the IsEnabled property
            Assert.IsTrue(tab.Enabled.Equals(true), tabName + " was not enabled, could not select when requested");

            //Click it
            tab.Click();
        }