Пример #1
0
        public void SelectWorkflow(string workflowName)
        {
            _engine.ExecuteJavaScript(DssWorkflowResource.DssWorkflowJavaScript);

            // Select the first menu (arbitrarily)
            string      firstMenu   = "document.getElementById('rootAppListBox').getElementsByTagName('li')[0]";
            BoundingBox boundingBox = _engine.GetElementBoundingArea(firstMenu);

            _engine.PressElementByBoundingArea(boundingBox);

            // Select the workflow
            try
            {
                DssWorkflowsReady(workflowName);

                _engine.ExecuteJavaScript(DssWorkflowResource.DssWorkflowJavaScript);
                PressElementByText("rootAppListBox", "li", workflowName);
            }
            catch (JavaScriptExecutionException)
            {
                throw new DeviceWorkflowException($"Unable to select workflow named '{workflowName}'.");
            }

            // Wait for the prompts to load
            _engine.WaitForHtmlContains("promptListBox", TimeSpan.FromSeconds(30));
        }
        /// <summary>
        /// Executes the job.
        /// </summary>
        /// <param name="workflow">The workflow.</param>
        /// <param name="documentName">The document name.</param>
        public bool ExecuteJob(string workflow, string documentName)
        {
            bool docNameFound = false;

            if (_engine.WaitForHtmlContains(workflow, TimeSpan.FromSeconds(20)))
            {
                _engine.ExecuteFunction("pressWorkflowButton", workflow);
                string fieldName = "name=\"Document Name:\"";
                docNameFound = _engine.WaitForHtmlContains(fieldName, TimeSpan.FromSeconds(10));

                if (docNameFound)
                {
                    string documentProcess = _engine.GetBrowserHtml();
                    docNameFound = ProcessDocumentFlow(documentProcess, documentName);
                }

                if (!docNameFound)
                {
                    throw new ElementNotFoundException("Unable to find text box for entering document name: " + documentName);
                }
            }
            else
            {
                throw new DeviceWorkflowException("Unable to execute workflow '" + workflow + "'.");
            }
            return(docNameFound);
        }
Пример #3
0
 /// <summary>
 /// Start Scan Job and finish
 /// </summary>
 public override void Scan(string emailAddress)
 {
     _engine.WaitForHtmlContains(_inputEmailAddress[0], TimeSpan.FromMilliseconds(5000));
     PressButton(_inputEmailAddress[0]);
     Pacekeeper.Sync();
     _controlPanel.TypeOnVirtualKeyboard(emailAddress);
     _controlPanel.Press("#hpid-keyboard-key-done");
     Pacekeeper.Pause();
     _engine.WaitForHtmlContains(_emailReady[0], TimeSpan.FromMilliseconds(10000));
     PressButton(_scanButton[0]);
     ScanJobFinish();
 }
Пример #4
0
 /// <summary>
 /// Presses the Copy Count area.
 /// </summary>
 public void PressCopyCount()
 {
     if (_engine.WaitForHtmlContains(_inputCopies[0], TimeSpan.FromSeconds(3)))
     {
         PressButton(_inputCopies[0]);
         Thread.Sleep(TimeSpan.FromMilliseconds(500));
     }
     else
     {
         throw new DeviceWorkflowException("Fail to find Copies textbox");
     }
 }
Пример #5
0
 /// <summary>
 /// Press the Print All and Delete
 /// </summary>
 public void PrintAllandDelete()
 {
     try
     {
         _engine.WaitForHtmlContains("Print All and Delete", TimeSpan.FromSeconds(2));
         PressElementIDbyText("td", "Print All and Delete");
     }
     catch (Exception)
     {
         throw new DeviceWorkflowException("Fail to press \"Print All and Delete\" button");
     }
 }
Пример #6
0
        /// <summary>
        /// Presses the panel button.
        /// </summary>
        /// <param name="btnTitle">Title of the button to be pressed</param>
        private void PressPanelButton(string btnTitle)
        {
            if (_engine.WaitForHtmlContains(btnTitle, DefaultScreenWait))
            {
                // find the actual panel button to be pressed
                List <string> btnTitles = GetBtnTitles(_engine.GetBrowserHtml());
                int           buttonIdx = btnTitles.FindIndex(t => t.ToLower().Equals(btnTitle.ToLower()));

                int        footerPos = GetFooterTop("footerOXPd");
                Coordinate btnCoord  = GetButtonCoordinates(btnTitles.Count(), buttonIdx);

                if (footerPos > _panelBottom)
                {
                    btnCoord = SwipeForHpcr(btnTitles, buttonIdx, footerPos, btnCoord);
                }
                else // footer position is about 256 so on a smaller screen
                {
                    btnCoord = PressScrollBarButton(btnTitles, buttonIdx, footerPos, btnCoord);
                }
                _controlPanel.PressScreen(btnCoord);
            }
            else
            {
                string msg = "Unknown HPCR folder requested, " + _scanDestination;
                UpdateStatus(msg);
                throw new DeviceWorkflowException(msg);
            }
        }
        private bool UseGeniusBytesPin()
        {
            OxpdBrowserEngine engine = new OxpdBrowserEngine(ControlPanel);

            for (int checkCount = 0; checkCount < 10; checkCount++)
            {
                if (engine.WaitForHtmlContains("Enter PIN", TimeSpan.FromSeconds(1)))
                {
                    return(true);
                }
                else if (engine.WaitForHtmlContains("Username", TimeSpan.FromSeconds(1)))
                {
                    return(false);
                }
            }
            return(false);
        }
Пример #8
0
        /// <summary>
        /// Calls the helping methods for processing the various HPCR workflows.
        /// </summary>
        /// <returns>bool</returns>
        private bool ProcessForHpcr(int pageCount = 1)
        {
            bool bSuccess = true;

            _yOffset = OxpdBrowserEngine.GetBrowserOffset(_controlPanel);
            TimeSpan ts = TimeSpan.FromSeconds(6);

            ProcessHPCR_Workflows();

            // if the document name is required for this app...
            if (IsDocumentFieldName())
            {
                SetDocumentName();

                // Press the next button
                PressHpcrButtonByCoordinate("More Options", 0);
            }

            VerifyReadyForScanning(true);
            ProcessHPCR_Work(pageCount, ts);

            RecordEvent(DeviceWorkflowMarker.ProcessingJobBegin);

            // press the done button based on its index
            _engine.WaitForHtmlContains("Done", TimeSpan.FromSeconds(6));

            RecordEvent(DeviceWorkflowMarker.ProcessingJobEnd);

            PressHpcrButtonByCoordinate(string.Empty, 1);

            AtHomeScreen(ts);

            return(bSuccess);
        }
        /// <summary>
        /// SignOut from Udocx
        /// </summary>
        private void LogOut()
        {
            OxpdBrowserEngine engine = new OxpdBrowserEngine(ControlPanel);

            if (engine.WaitForHtmlContains(_logoutButton[0], TimeSpan.FromMilliseconds(5000)))
            {
                PressButton(_logoutButton[0]);
            }
        }
Пример #10
0
        /// <summary>
        /// Executes the job.
        /// </summary>
        /// <param name="workflow">The workflow.</param>
        /// <param name="documentName">The document name.</param>
        public bool ExecuteJob(string workflow, string documentName)
        {
            bool done = false;

            if (_engine.WaitForHtmlContains("Send to", TimeSpan.FromSeconds(20)))
            {
                _engine.ExecuteFunction("pressWorkflowButton", workflow);

                ProcessDocumentName(documentName);

                _controlPanel.WaitForValue(_hpecNotificationPanel, "innerText", OmniPropertyType.Property, _workflowOptionTitles[0], StringMatch.Contains);
                done = true;
            }
            else
            {
                throw new ControlNotFoundException("The HPEC workflow button, " + workflow + ", could not be found.");
            }
            return(done);
        }
        /// <summary>
        /// Signs into the HP JetAdvantage Cloud
        /// </summary>
        public virtual void SignIn()
        {
            // Press the HP JetAdvantage (Titan) button
            string controlName = "mAccessPointDisplay";

            _device.ControlPanel.WaitForControl(controlName, TimeSpan.FromSeconds(200));
            PressAppButtonByProperty(controlName, "Title", "HP JetAdvantage", OXP_MAIN_FORM, ignorePopups: true);

            // if the email textbox is available than able to access the server
            if (_engine.WaitForHtmlContains("email-textbox", TimeSpan.FromSeconds(15)))
            {
                UpdateStatus("Selecting User.");
                SelectUser("different-user");

                // set the login ID and password
                UpdateStatus("Filling out HP JetAdvantage login and password data.");
                EnterLoginPassword();

                if (_data.UseLoginPin)
                {
                    //click create pin
                    UpdateStatus("Selecting Create PIN.");
                    PressButton("create-pin-checkbox");

                    //Login to JetAdvantage
                    UpdateStatus("Pressing the HP JetAdvantage login Button");
                    PressButton("login-button");

                    _engine.WaitForHtmlContains("keypad", TimeSpan.FromSeconds(15));
                    _device.ControlPanel.Type(_data.JetAdvantageLoginPin);

                    PressButton("dialog normal show", "dialog-confirm-button button-keypad primary done");
                }
                else
                {
                    UpdateStatus("Pressing the HP JetAdvantage login Button");
                    PressButton("login-button");
                }

                _engine.WaitForHtmlContains("hp-scansend", TimeSpan.FromSeconds(15));
            }
            else
            {
                throw new Exception("Unable to sign in to HP JetAdvantage.");
            }
        }
 /// <summary>
 /// Signin in Udocx
 /// </summary>
 /// <param name="id">id for signin</param>
 /// <param name="pw">pw for signin</param>
 private void Login(string id, string pw)
 {
     try
     {
         if (!_engine.HtmlContains(_differentUser[0]))
         {
             PressButton(_inputId[0]);
             _controlPanel.WaitForAvailable("#hpid-keyboard-key-done", _idleTimeoutOffset);
             _controlPanel.TypeOnVirtualKeyboard(id);
             Pacekeeper.Sync();
             PressButton(_inputPw[0]);
             _controlPanel.WaitForAvailable("#hpid-keyboard-key-done", _idleTimeoutOffset);
             _controlPanel.TypeOnVirtualKeyboard(pw);
             Pacekeeper.Sync();
         }
         else
         {
             PressButton(_differentUser[0]);
             _engine.WaitForHtmlContains(_inputId[0], TimeSpan.FromMilliseconds(20000));
             PressButton(_inputId[0]);
             _controlPanel.WaitForAvailable("#hpid-keyboard-key-done", _idleTimeoutOffset);
             _controlPanel.TypeOnVirtualKeyboard(id);
             Pacekeeper.Sync();
             PressButton(_inputPw[0]);
             _controlPanel.WaitForAvailable("#hpid-keyboard-key-done", _idleTimeoutOffset);
             _controlPanel.TypeOnVirtualKeyboard(pw);
             Pacekeeper.Sync();
         }
         _controlPanel.Press("#hpid-keyboard-key-done");
         Pacekeeper.Pause();
     }
     catch (Exception ex)
     {
         DeviceWorkflowException e = new DeviceWorkflowException("Fail to signIn", ex);
         throw e;
     }
 }
Пример #13
0
        /// <summary>
        /// Wait for job completed
        /// </summary>
        public override bool WaitForScanning(int scanCount)
        {
            int _count = 0;

            while (_controlPanel.CheckState("#hpid-button-Cancel", OmniElementState.Exists))
            {
                if (_count > 100)
                {
                    return(false);
                }
                _count++;
                Thread.Sleep(500);
            }
            Thread.Sleep(3000);
            PressButton(_okButtonIdScan[0]);
            return(_engine.WaitForHtmlContains(_homeButtonId[0], TimeSpan.FromSeconds(5)));
        }
Пример #14
0
        /// <summary>
        /// Launches Hpac Scan with the specified authenticator using the given authentication mode
        /// </summary>
        /// <param name="authenticator">The authenticator</param>
        /// <param name="authenticationMode">The authentication mode, eager or lazy</param>
        public override void Launch(IAuthenticator authenticator, AuthenticationMode authenticationMode)
        {
            _controlPanel.SignalUserActivity();
            _launchHelper.WorkflowLogger = WorkflowLogger;
            switch (authenticator.Provider)
            {
            case AuthenticationProvider.Skip:
                break;

            default:
                PressSecureScanButton();
                break;
            }

            _engine.WaitForHtmlContains("LOGIN_USER", TimeSpan.FromSeconds(30));
            RecordEvent(DeviceWorkflowMarker.AppShown);

            RecordEvent(DeviceWorkflowMarker.AuthenticationBegin);
            Authenticate(authenticator, JediOmniLaunchHelper.LazySuccessScreen);
            RecordEvent(DeviceWorkflowMarker.AuthenticationEnd);
        }
Пример #15
0
 /// <summary>
 /// Wait specific value for available
 /// </summary>
 /// <param name="value">Value for waiting</param>
 /// <param name="time">Waiting time</param>
 /// <returns></returns>
 public bool WaitObjectForAvailable(string value, TimeSpan time)
 {
     return(_engine.WaitForHtmlContains(value, time));
 }