/// <summary> /// Enters the user name, password. /// </summary> protected override void EnterUserNamePassword() { OxpdBrowserEngine engine = new OxpdBrowserEngine(ControlPanel); // The following code is not needed here. SetProvider will have already been called from the base class. See AuthenticatorBase lines 62-66 // In the ISecStar plugin, to force the code to use ISecStar every time, remove the "Auto-Detect" options from the plugin dropdown. //if (!(ControlPanel.CheckState($"{AuthDropdownId} .hp-listitem-text:contains({ProviderMap[provider].SetText})", OmniElementState.Exists))) //{ // SetProvider(AuthenticationProvider.ISecStar); //} engine.PressElementById("username"); ControlPanel.WaitForAvailable("#hpid-keyboard", TimeSpan.FromSeconds(4)); ControlPanel.TypeOnVirtualKeyboard(Credential.UserName); if (ControlPanel.WaitForAvailable(("#hpid-keyboard-key-done"))) { ControlPanel.Press("#hpid-keyboard-key-done"); } engine.PressElementById("password"); ControlPanel.WaitForAvailable("#hpid-keyboard", TimeSpan.FromSeconds(4)); ControlPanel.TypeOnVirtualKeyboard(Credential.Password); if (ControlPanel.WaitForAvailable(("#hpid-keyboard-key-done"))) { ControlPanel.Press("#hpid-keyboard-key-done"); } engine.PressElementById("okayButton"); }
/// <summary> /// Selects the documents in the given list /// </summary> /// <param name="documentIds">The document ids.</param> /// <exception cref="System.NotImplementedException"></exception> public void SelectDocuments(IEnumerable <string> documentIds) { foreach (string docId in documentIds) { _engine.PressElementById(docId); } }
/// <summary> /// Sends to network folder workflow. /// </summary> /// <exception cref="DeviceInvalidOperationException">Unexpected HTML: expecting 'Media size'</exception> private bool ProcessDocumentFlow(string documentProcess, string documentName) { SetDocumentName(documentProcess, documentName); _engine.PressElementById("NEXT_BUTTON"); if (!_engine.WaitForHtmlContains(">Media size<", TimeSpan.FromSeconds(30))) { throw new DeviceInvalidOperationException("Unexpected HTML: expecting 'Media size'"); } return(true); }
private void TurnOnOffOptions(AutoStoreExecutionOptions executionOptions, TimeSpan ts) { _engine.PressElementById(MoreOptionsBtnId); WaitForButtonExist(MoreOptionsBtnId, ts); SetOption(ts, MoreOptionsImagePreview, executionOptions.ImagePreview); bool turnOnOption = (executionOptions.JobBuildSegments > 1) == true ? true : false; SetOption(ts, MoreOptionsJobBuild, turnOnOption); _engine.PressElementById(HideMoreOptionsBtnId); }
public void SelectPrompt(string prompt) { _engine.ExecuteJavaScript(DssWorkflowResource.DssWorkflowJavaScript); try { PressElementByText("promptListBox", "span", prompt); _engine.PressElementById(prompt); } catch (JavaScriptExecutionException) { throw new DeviceWorkflowException($"Unable to select prompt named '{prompt}'."); } }
/// <summary> /// Workflow process to send to network folder. /// </summary> private void ProcessDocumentName(string documentName) { _controlPanel.WaitForValue(".hp-masthead-title:last", "innerText", OmniPropertyType.Property, _workflowOptionTitles[1], StringMatch.Contains, TimeSpan.FromSeconds(5)); string textboxId = GetTextboxId(_engine.GetBrowserHtml()); _engine.PressElementById(textboxId); PlayKeyBoard(documentName); }
/// <summary> /// Writes the given text into the given control ID. /// </summary> /// <param name="objectId">string</param> /// <param name="textToType">int</param> private void PlayKeyboard(string objectId, string textToType) { _engine.PressElementById(objectId); _controlPanel.WaitForControl("mKeyboard", TimeSpan.FromSeconds(3)); _controlPanel.TypeOnVirtualKeyboard("mKeyboard", textToType); Thread.Sleep(2000); _controlPanel.Press("ok"); }
/// <summary> /// Turns the on options for either image preview or job build. /// </summary> /// <param name="pageCount">The page count.</param> private void TurnOnOptions(int pageCount) { if (_version1_6) { _engine.PressElementById("btnIdScanSettings"); if (_imagePreview || pageCount > 1) { string[] onOff = null; var values = _engine.ExecuteFunction("getOptionIds"); string[] ids = values.Replace("undefined", "").Trim().Split(';'); if (_imagePreview) { PressOptionButton(ids, "Image Preview"); onOff = GetPanelIds(); PressOptionButton(onOff, "On"); } if (pageCount > 1) { PressOptionButton(ids, "Job Build"); if (onOff == null) { onOff = GetPanelIds(); } PressOptionButton(onOff, "On"); } } _engine.PressElementById("btnIdOk"); } else { Options1_5(pageCount); } VerifyReadyForScanning(true); }
/// <summary> /// Presses a button on the control panel. /// </summary> /// <param name="printButtonId">The id of the print button to press</param> private void PressButton(string printButtonId) { _engine.PressElementById(printButtonId); }
/// <summary> /// Un-selects all documents except the first. /// </summary> /// <param name="documentValue">The javascript values (dynamically generated) for toggling the checkbox selection.</param> public virtual void SelectFirstDocument(string documentValue) { _engine.PressElementById(documentValue); }
/// <summary> /// Presses a button on the control panel. /// </summary> /// <param name="buttonId">The id of the button to press</param> public void PressButton(string buttonId) { _engine.PressElementById(buttonId); }
/// <summary> /// Press Element by Text /// </summary> protected void PressElementIDbyText(string tag, string text) { TimeSpan interval = TimeSpan.FromSeconds(3); TimeSpan timeOut = TimeSpan.FromSeconds(6); Func <bool> action = new Func <bool>(() => { try { string existId = _engine.ExecuteFunction("getElementIdbyText", tag, text).Trim('"'); _engine.PressElementById(existId); return(true); } catch (JavaScriptExecutionException) { return(false); } }); try { if (!Wait.ForTrue(action, timeOut, interval)) { throw new DeviceWorkflowException($"Did not find '{text}' element within {timeOut.TotalSeconds} seconds."); } } catch (Exception ex) { throw new DeviceWorkflowException($"Did not find '{text}' element within {timeOut.TotalSeconds} seconds.", ex); } }