コード例 #1
0
        /// <summary>
        /// Selects the folder quickset with the specified name.
        /// <param name="linkApp_ID">ID of the Link application for sign in on AA</param>
        /// <param name="linkApp_PWD">PW of the Link application for sign in on AA</param>
        /// <param name="login">Webview of the Link application for signin on AA</param>
        /// </summary>
        public bool SignIn(string linkApp_ID, string linkApp_PWD, WebviewObject login)
        {
            bool result = true;

            RecordEvent(DeviceWorkflowMarker.EnterCredentialsBegin);
            result = login.SetText("//*[@id=\"Email\"]", linkApp_ID, false);
            // Insert the ID

            if (result)
            {
                result = login.Click("//*[@id=\"next\"]");
            }
            // Click "Next" Button

            if (result && login.IsExist("//*[@id=\"Passwd\"]", TimeSpan.FromSeconds(10)))
            {
                result = login.SetText("//*[@id=\"Passwd\"]", linkApp_PWD, false);
            }
            // Insert the PW
            RecordEvent(DeviceWorkflowMarker.EnterCredentialsEnd);

            if (result)
            {
                result = login.Click("//*[@id=\"signIn\"]");
            }
            // Click SignIn Button

            if (result && login.IsExist("//*[@id=\"submit_approve_access\"]", TimeSpan.FromSeconds(10)))
            {
                result = login.Click("//*[@id=\"submit_approve_access\"]");
            }
            // Check that Approve Button is displayed

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Selects the folder quickset with the specified name.
        /// <param name="linkApp_ID">ID of the Link application for sign in on AA</param>
        /// <param name="linkApp_PWD">PW of the Link application for sign in on AA</param>
        /// </summary>
        public bool SignIn(string linkApp_ID, string linkApp_PWD)
        {
            bool result = true;

            using (WebviewObject singinPanel = _linkUI.Controller.GetWebView())
            {
                RecordEvent(DeviceWorkflowMarker.EnterCredentialsBegin);

                //_controller.PressKey(KeyCode.KEYCODE_WAKEUP);

                // Insert the ID and Click "Next" Button
                result = singinPanel.SetText("//*[@class=\"placeholderContainer\"]/input[1]", linkApp_ID + OpenQA.Selenium.Keys.Enter, false);
                UpdateStatus($"Input ID and Click Next Button result : {result}");
                Thread.Sleep(TimeSpan.FromSeconds(5));

                // Insert the PW and Click SignIn Button
                if (result)
                {
                    result = singinPanel.IsExist("//*[@class=\"placeholderContainer\"]/input[1]", TimeSpan.FromSeconds(10));
                    result = singinPanel.SetText("//*[@class=\"placeholderContainer\"]/input[1]", linkApp_PWD + OpenQA.Selenium.Keys.Enter, false);
                }
                UpdateStatus($"Input PW and Click Login Button result : {result}");
                RecordEvent(DeviceWorkflowMarker.EnterCredentialsEnd);

                if (_staySignedInPopup)
                {
                    singinPanel.Click("//*[@id='idBtn_Back']");
                }
            }
            return(result);
        }
コード例 #3
0
        /// <summary>
        /// Do login the LinkApps using ID/PW
        /// </summary>
        /// <param name="id">ID for doing login the application</param>
        /// <param name="pw">PW for doing login the application</param>
        public void Login(string id, string pw)
        {
            int      timeOut   = LinkUI.Controller.GetTimeout();
            bool     result    = false;
            DateTime startTime = DateTime.Now;

            RecordEvent(DeviceWorkflowMarker.AuthenticationBegin);
            try
            {
                result = JetAdvantageLinkControlHelper.WaitingObjectDisappear(new UiSelector().ResourceId($"{ClioAppsPackageName}:id/iv_dots_bg"), 500, 80);

                if (!result)
                {
                    DeviceWorkflowException e = new DeviceWorkflowException($"Fail to find progress bar");
                    e.Data.Add(_exceptionCategoryData, ConnectorExceptionCategory.SignIn.GetDescription());
                    throw e;
                }

                Thread.Sleep(TimeSpan.FromSeconds(3));
                using (WebviewObject loginPanel = LinkUI.Controller.GetWebView())
                {
                    if (loginPanel.IsExist("//*[@name=\"email\"]", TimeSpan.FromSeconds(30)))
                    {
                        RecordEvent(DeviceWorkflowMarker.EnterCredentialsBegin);
                        UpdateStatus($"id = {id}, pwd = {pw}");
                        result = loginPanel.SetText("//*[@name=\"email\"]", id, false);
                        if (result)
                        {
                            result = loginPanel.SetText("//*[@name=\"password\"]", pw, false);
                        }
                        RecordEvent(DeviceWorkflowMarker.EnterCredentialsEnd);
                        if (result)
                        {
                            result = loginPanel.Click("//*[@id=\"submit\"]");
                        }

                        if (result)
                        {
                            result = loginPanel.Click("//*[@id=\"main\"]/div[1]/div/span/th-row/th-column[2]/div/div[2]/div/form[1]/th-button/button", TimeSpan.FromSeconds(20));
                        }
                    }
                    else
                    {
                        result = false;
                    }
                }
            }
            catch (NullReferenceException ex)
            {
                DeviceCommunicationException e = new DeviceCommunicationException("Fail to get webview - You need check used hpk file is \"webview debuggable option\" enabled", ex);
                e.Data.Add(_exceptionCategoryData, ConnectorExceptionCategory.EnvironmentError.GetDescription());
                throw e;
            }
            if (result)
            {
                if (LinkUI.Controller.DoesScreenContains(new UiSelector().ResourceId($"{ClioAppsPackageName}:id/buttonClose")))
                {
                    CloseDetailPopup();
                }
                CloseAppGuide();
                CheckServerErrorPopup();
                RecordEvent(DeviceWorkflowMarker.AuthenticationEnd);
                UpdateStatus($"Sign in completed - {DateTime.Now.Subtract(startTime).TotalSeconds} secs");
                LinkUI.Controller.SetTimeout(_inactivityTimeLimit / 1000);
                //ms => second
                LinkUI.Controller.SetTimeout(timeOut);
            }
            if (!result)
            {
                DeviceWorkflowException e = new DeviceWorkflowException($"Fail to log in by ({id}) :: {_appName}");
                e.Data.Add(_exceptionCategoryData, ConnectorExceptionCategory.SignIn.GetDescription());
                throw e;
            }
            RecordEvent(DeviceWorkflowMarker.AppShown);
        }
コード例 #4
0
        /// <summary>
        /// Selects the folder quickset with the specified name.
        /// <param name="linkApp_ID">ID of the Link application for sign in on AA</param>
        /// <param name="linkApp_PWD">PW of the Link application for sign in on AA</param>
        /// </summary>
        public bool SignIn(string linkApp_ID, string linkApp_PWD)
        {
            bool result     = true;
            bool googleAuth = false;

            googleAuth = linkApp_ID.Contains("@gmail.com");
            // Check that ID uses google auth

            if (googleAuth)
            {
                using (WebviewObject loginPanel = _linkUI.Controller.GetWebView())
                {
                    if (loginPanel.IsExist("//*[@id=\"regular-login-forms\"]/div/div/div/button/div", TimeSpan.FromSeconds(60)))
                    {
                        result = loginPanel.Click("//*[@id=\"regular-login-forms\"]/div/div/div/button/div");

                        if (result)
                        {
                            if (WorkflowLogger != null)
                            {
                                GoogleSignIn.WorkflowLogger = WorkflowLogger;
                            }
                            result = GoogleSignIn.SignIn(linkApp_ID, linkApp_PWD, loginPanel);
                        }
                    }
                    else
                    {
                        result = false;
                    }
                }
            }
            else
            {
                //ID is using google AA
                using (WebviewObject loginPanel = _linkUI.Controller.GetWebView())
                {
                    RecordEvent(DeviceWorkflowMarker.EnterCredentialsBegin);

                    if (loginPanel.IsExist("//*[@class='text-input-input'][@type='email'][@name='login_email']", TimeSpan.FromSeconds(60)))
                    {
                        result = loginPanel.SetText("//*[@class='text-input-input'][@type='email'][@name='login_email']", linkApp_ID, false);
                    }
                    else
                    {
                        result = false;
                    }

                    // Insert the ID
                    if (result)
                    {
                        result = loginPanel.SetText("//*[@class='password-input text-input-input'][@type='password'][@name='login_password']", linkApp_PWD, false);
                    }
                    // Insert the PW
                    RecordEvent(DeviceWorkflowMarker.EnterCredentialsEnd);
                    if (result)
                    {
                        result = loginPanel.Click("//*[@id=\"regular-login-forms\"]/div/form/div[3]/button/div[1]");
                        // Submit Button
                    }
                    // Click SignIn Button
                    loginPanel.Click("//*[@id=\"authorize-form\"]/button[2]", TimeSpan.FromSeconds(5));
                }
            }
            return(result);
        }