/// <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);
        }
示例#2
0
        private IEnumerable <string> GetDocumentIdsOldStyle()
        {
            var result = new List <string>();

            string docListXpath = "//table[@id='scrollingContent']//div[@class='labelOXPd']";
            string rawHtml      = string.Empty;

            rawHtml = _engine.GetBrowserHtml();
            var doc = new HtmlAgilityPack.HtmlDocument();

            doc.LoadHtml(rawHtml);

            var nodes = doc.DocumentNode.SelectNodes(docListXpath);

            if (nodes != null)
            {
                foreach (var node in nodes)
                {
                    var id = GetDocumentIdFromNode(node);
                    result.Add(id);
                }
            }

            return(result.Distinct());
        }
示例#3
0
        /// <summary>
        /// Determines whether the devices current form is requesting the document name.
        /// </summary>
        /// <returns>bool</returns>
        private bool IsDocumentFieldName()
        {
            bool bDocumentField = true;

            string result = _engine.GetBrowserHtml();

            if (!result.Contains("id=\"FieldDeliveredDocumentName\""))
            {
                bDocumentField = false;
            }
            return(bDocumentField);
        }
        /// <summary>
        /// Runs the HP JetAdvantage automated process.
        /// </summary>
        private void RunHPJetAdvantage()
        {
            _engine.GetBrowserHtml();
            // press the scan to cloud button
            UpdateStatus("Preparing for the Helios Scan to Cloud.");
            PressButton("hp-scansend");
            UpdateStatus("Scan App is Launched.");
            string htm1 = _engine.GetBrowserHtml();

            if (!HasCloudStorageError(htm1))
            {
                ScanDocuments();
            }
            else
            {
                PressButton("choice-error-dialog-template-inst8", "dialog - dismiss - button tertiary");
                UpdateStatus("No Cloud Storage available, logging out.");
            }

            Logout();
        }
示例#5
0
        /// <summary>
        /// Gets the list of document ids currently displayed
        /// The expectation is that each document/job name coming from STF will contain at least a partial GUID.
        /// This function parses looking for this pattern and extracting the GUIDs.
        /// </summary>
        /// <returns>List of document ids</returns>
        public HtmlNodeCollection GetDocumentsInfo(bool distinctOnly = true)
        {
            string docListXpath = "//table[@id='scrollingContent']//input[@type='checkbox']";

            string             rawHtml = string.Empty;
            HtmlNodeCollection nodes;

            try
            {
                rawHtml = _engine.GetBrowserHtml();
                var doc = new HtmlDocument();
                doc.LoadHtml(rawHtml);
                nodes = doc.DocumentNode.SelectNodes(docListXpath);
            }
            catch (Exception ex)
            {
                ExecutionServices.SystemTrace.LogError("Error getting last document id", ex);
                ExecutionServices.SystemTrace.LogDebug($"Retrieved HTML:\n{rawHtml}");
                throw;
            }
            return(nodes);
        }
示例#6
0
 /// <summary>
 /// Jobs the finished.
 /// </summary>
 public void JobFinished()
 {
     ReportedHpecPageCount = GetReportedPageCount(_engine.GetBrowserHtml());
     _engine.ExecuteFunction("pressScanButton", "Exit");
 }