コード例 #1
0
        /// <summary>
        /// Stays in a holding pattern with Hpec processes the job after scan.
        /// </summary>
        public bool ProcessJobAfterScan()
        {
            _controlPanel.WaitForValue(".hp-masthead-title:last", "innerText", OmniPropertyType.Property, "Processing...", StringMatch.Contains, TimeSpan.FromSeconds(3));

            // Doing the check here just in case the popup occurs first. This will save waiting 30 seconds for the notification panel to fail.
            if (_controlPanel.CheckState(".hp-popup-modal-overlay", OmniElementState.Exists))
            {
                ProcessScanError();
            }
            RecordEvent(DeviceWorkflowMarker.ProcessingJobBegin);
            if (_notificationPanel.WaitForState(OmniElementState.VisibleCompletely))
            {
                _notificationPanel.WaitForDisplaying("Processing...");
                _notificationPanel.WaitForNotDisplaying("Processing...");
            }
            else if (_controlPanel.CheckState(".hp-popup-modal-overlay", OmniElementState.Exists))
            {
                ProcessScanError();
            }

            _controlPanel.WaitForValue(".hp-masthead-title:last", "innerText", OmniPropertyType.Property, "Result", StringMatch.Contains, TimeSpan.FromSeconds(120));
            RecordEvent(DeviceWorkflowMarker.ProcessingJobEnd);

            if (!_engine.WaitForHtmlContains("Scanned pages", TimeSpan.FromSeconds(6)))
            {
                throw new DeviceWorkflowException("Unable to determine number of pages scanned.");
            }
            return(true);
        }
コード例 #2
0
        private bool ProcessNoStatusBanner(ScanExecutionOptions executionOptions)
        {
            if (_popupManager.WaitForPopup("Contacting Quota server", TimeSpan.FromSeconds(2)))
            {
                _popupManager.HandleTemporaryPopup("Contacting Quota server", TimeSpan.FromSeconds(30));
            }

            _notificationPanel.WaitForNotDisplaying("Initiating job");
            _notificationPanel.WaitForNotDisplaying("Pending");
            RecordEvent(DeviceWorkflowMarker.ProcessingJobEnd);

            if (executionOptions.JobBuildSegments == 0)
            {
                RecordEvent(DeviceWorkflowMarker.ScanJobBegin);
                _notificationPanel.WaitForNotDisplaying(_idleTimeoutOffset, "Scanning");
                RecordEvent(DeviceWorkflowMarker.ScanJobEnd);
            }

            return(MarkSendingJob(statusMsg: string.Empty));
        }
コード例 #3
0
        /// <summary>
        /// Navigate to home.
        /// </summary>
        private void NavigateHome()
        {
            while (_controlPanel.WaitForState(".hp-button-back:last", OmniElementState.Useable, TimeSpan.FromSeconds(10)))
            {
                _controlPanel.Press(".hp-button-back:last");
            }

            var controls = _controlPanel.GetIds("div", OmniIdCollectionType.Children);

            if (controls.Contains("hpid-button-reset"))
            {
                if (_controlPanel.WaitForState("#hpid-button-reset", OmniElementState.Useable, TimeSpan.FromSeconds(10)))
                {
                    _controlPanel.Press("#hpid-button-reset");
                }
                else
                {
                    string value = _controlPanel.GetValue("#hp-button-signin-or-signout", "innerText", OmniPropertyType.Property).Trim();
                    if (value.Contains("Sign Out"))
                    {
                        if (_controlPanel.WaitForState("#hp-button-signin-or-signout", OmniElementState.Useable, TimeSpan.FromSeconds(10)))
                        {
                            _controlPanel.Press("#hp-button-signin-or-signout");
                        }
                    }
                }
            }

            _controlPanel.PressHome();

            if (!_controlPanel.WaitForState("#hpid-homescreen-logo-icon", OmniElementState.VisibleCompletely, TimeSpan.FromSeconds(5)))
            {
                throw new DeviceWorkflowException("Home Page is not accessible");
            }
            bool success = _notificationPanel.WaitForNotDisplaying("Initializing scanner", "Clearing settings");

            if (!success)
            {
                throw new TimeoutException($"Timed out waiting for notification panel state: Contains Initializing scanner, Clearing settings");
            }
        }