/// <summary> /// Enters the "To" email address. /// </summary> /// <param name="emailAddresses">The "To" email addresses.</param> public void EnterToAddress(IEnumerable <string> emailAddresses) { foreach (string address in emailAddresses) { if (_controlPanel.WaitForDisplayedText("From", HP.DeviceAutomation.StringMatch.Contains, TimeSpan.FromSeconds(6))) { string btnName = _executionManager.GetButtonName("cTo"); _controlPanel.Press(btnName); _controlPanel.WaitForVirtualButton("cNewTouchButton"); _controlPanel.Press("cNewTouchButton"); Pacekeeper.Pause(); _controlPanel.TypeOnVirtualKeyboard(address); Pacekeeper.Pause(); _controlPanel.Press(_executionManager.OkayButton); _controlPanel.WaitForVirtualButton("cNOString"); _controlPanel.Press("cNOString"); _controlPanel.WaitForVirtualButton("cDoneTouchButton"); _controlPanel.Press("cDoneTouchButton"); } } }
/// <summary> /// Enters the user name and password on the device control panel. /// </summary> private void EnterUserNamePassword() { var currentScreenLabels = ControlPanel.GetScreenInfo().ScreenLabels.ToList(); if (currentScreenLabels.Contains("AnA_Login_With_Windows_Authentication") || currentScreenLabels.Contains("AnA_Login_With_LDAP_Authentication")) { string doneButtonId = "_done"; string userNameButton = _userNameButtonId[(int)_screenSize]; string userNameWidget = _userNameWidgetId[(int)_screenSize]; //Enter UserName ControlPanel.Press(userNameButton); Pacekeeper.Pause(); ControlPanel.SetValue(userNameWidget, Credential.UserName); ControlPanel.WaitForWidget(doneButtonId); Pacekeeper.Pause(); ControlPanel.Press(doneButtonId); Pacekeeper.Sync(); //Enter Password ControlPanel.Press(_passwordButtonId[(int)_screenSize]); Pacekeeper.Pause(); ControlPanel.SetValue(_passwordWidgetId[(int)_screenSize], Credential.Password); ControlPanel.WaitForWidget(doneButtonId); Pacekeeper.Pause(); ControlPanel.Press(doneButtonId); Pacekeeper.Sync(); } }
/// <summary> /// Adds the specified name for the job /// </summary> /// <param name="jobname">The job name.</param> /// <exception cref="HP.ScalableTest.DeviceAutomation.DeviceWorkflowException"> /// File name is not user-editable. /// or /// $Error entering file name: {message} /// </exception> public void AddJobName(string jobname) { try { _controlPanel.PressToNavigate("mFileNameTextBox", "SaveToUsbKeyboardForm", ignorePopups: false); Pacekeeper.Pause(); _controlPanel.TypeOnVirtualKeyboard("mKeyboard", jobname); Pacekeeper.Sync(); _controlPanel.PressToNavigate("ok", SAVE_TO_USB_FORM, ignorePopups: false); Pacekeeper.Pause(); } catch (WindjammerInvalidOperationException ex) { switch (_controlPanel.CurrentForm()) { case SAVE_TO_USB_FORM: if (_controlPanel.GetProperty <bool>("mFileNameTextBox", "Enabled") == false) { throw new DeviceWorkflowException("File name is not user-editable.", ex); } else { throw; } case "OneButtonMessageBox": string message = _controlPanel.GetProperty("mMessageLabel", "Text"); throw new DeviceWorkflowException($"Error entering file name: {message}", ex); default: throw; } } }
/// <summary> /// Sets the number of copies to print /// </summary> /// <param name="copies">No of copies to be set</param> public void SetNumCopies(int copies) { TimeSpan timeout = TimeSpan.FromSeconds(5); if (_deviceScreen.IsSmallSize) { //On small screens, the Options cover up the "Copy" button, so close it. CloseOptionsPanel(); } if (!_device.ControlPanel.WaitForAvailable("#hpid-copy-start-copies", timeout)) { throw new DeviceWorkflowException($"# of Copies textbox did not become available within {timeout.TotalSeconds} seconds."); } //Click on Copy start. _device.ControlPanel.Press("#hpid-copy-start-copies"); Pacekeeper.Pause(); if (!_device.ControlPanel.WaitForAvailable("#hpid-keypad-key-close", timeout)) { throw new DeviceWorkflowException($"Keyboard did not close within {timeout.TotalSeconds} seconds."); } // Enter no. of copies _device.ControlPanel.TypeOnNumericKeypad(copies.ToString()); //Close the numeric keypad _device.ControlPanel.Press("#hpid-keypad-key-close"); Pacekeeper.Pause(); }
/// <summary> /// Set text for Watermark /// </summary> /// <param name="watermarkText">Text to be set for watermark</param> public void SetWaterMark(string watermarkText) { OpenOptionsPanel(); _device.ControlPanel.ScrollPressWait("#hpid-option-watermark", "#hpid-option-watermark-screen", _activeScreenTimeout); _device.ControlPanel.ScrollPress("#hpid-watermark-type-button"); if (_device.ControlPanel.WaitForState("#hpid-watermark-type-list", OmniElementState.Useable)) { _device.ControlPanel.ScrollPress("#hpid-watermark-type-list-textwatermark"); } //Added a wait for the watermark textbox to be useable to enter values. Issue seen in a a few devices which are comparitively slow if (_device.ControlPanel.WaitForState("#hpid-watermark-text-textbox", OmniElementState.Useable, _activeScreenTimeout)) { _device.ControlPanel.ScrollPress("#hpid-watermark-text-textbox"); } Pacekeeper.Pause(); _device.ControlPanel.TypeOnVirtualKeyboard(watermarkText); _device.ControlPanel.WaitForState("#hpid-keyboard-key-done", OmniElementState.Useable, TimeSpan.FromSeconds(10)); _device.ControlPanel.Press("#hpid-keyboard-key-done"); if (_device.ControlPanel.WaitForState(".hp-button-done", OmniElementState.Useable, _activeScreenTimeout)) { _device.ControlPanel.Press(".hp-button-done"); } Pacekeeper.Pause(); }
/// <summary> /// Sets the color to print /// </summary> /// <param name="color">Color of the print</param> public void SetColor(string color) { OpenOptionsPanel(); //For Color/Black Option if (_device.ControlPanel.CheckState("#hpid-copy-color-mode-button", OmniElementState.Exists)) { //Select color/Black _device.ControlPanel.ScrollPressWait("#hpid-option-color-black", "#hpid-option-color-black-screen", TimeSpan.FromSeconds(2)); Pacekeeper.Pause(); //Color Option if (string.Equals(color, "Color", StringComparison.CurrentCultureIgnoreCase)) { _device.ControlPanel.ScrollPress("#hpid-color-black-selection-color"); Pacekeeper.Pause(); } //For monochrome else if (string.Equals(color, "monochrome", StringComparison.CurrentCultureIgnoreCase)) { _device.ControlPanel.ScrollPress("#hpid-color-black-selection-grayscale"); Pacekeeper.Pause(); } //For Automatically detect else { _device.ControlPanel.ScrollPress("#hpid-color-black-selection-autodetect"); Pacekeeper.Pause(); } } }
/// <summary> /// Enters the PIN on the device control panel. /// </summary> protected void EnterPin() { if (ControlPanel.WaitForScreenLabel("vw_sips_apps_state", TimeSpan.FromSeconds(40))) { Widget widget = FindWidget("sips_app_screen_header"); if (widget != null) { //Handling remote jobs widget = FindWidget("fb_footerCenter"); if (widget != null) { ControlPanel.Press("fb_footerCenter"); } ControlPanel.WaitForWidget("object0", TimeSpan.FromSeconds(20)); ControlPanel.SetValue("object0", Credential.Pin); Pacekeeper.Pause(); return; } } // Did not find the expected screens to enter a PIN. throw new DeviceWorkflowException("Unable to enter PIN code."); }
/// <summary> /// Launches the Email application using the specified authenticator and authentication mode. /// </summary> /// <param name="authenticator">The authenticator.</param> /// <param name="authenticationMode">The authentication mode.</param> /// <exception cref="System.NotImplementedException"></exception> public void Launch(IAuthenticator authenticator, AuthenticationMode authenticationMode) { if (authenticationMode.Equals(AuthenticationMode.Lazy)) { try { _controlPanel.Press("cScanHomeTouchButton"); if (_controlPanel.WaitForDisplayedText("Scan Menu", TimeSpan.FromSeconds(1))) { _controlPanel.Press("cEmailUiEmailDocument"); } Pacekeeper.Pause(); if (_controlPanel.WaitForDisplayedText("Scan to E-mail", TimeSpan.FromSeconds(1))) { _controlPanel.Press("cSendAnEmail"); } Thread.Sleep(TimeSpan.FromSeconds(2)); authenticator.Authenticate(); _controlPanel.WaitForDisplayedText("unknown", TimeSpan.FromSeconds(30)); } catch (PhoenixInvalidOperationException ex) { throw new DeviceWorkflowException($"Could not launch Email application: {ex.Message}", ex); } } else // AuthenticationMode.Eager { throw new NotImplementedException("Eager Authentication has not been implemented in PhoenixMagicFrameEmailApp."); } }
/// <summary> /// Enters the name to use for the scanned file. /// </summary> /// <param name="fileName">The file name.</param> public void EnterFileName(string fileName) { var data = _controlPanel.GetDisplayedStrings(); if (data.Contains("Next")) { _controlPanel.Press("cNextTouchButton"); } if (_controlPanel.WaitForVirtualButton(_executionManager.JobSettingsButton, TimeSpan.FromSeconds(6))) { _controlPanel.Press(_executionManager.JobSettingsButton); _controlPanel.WaitForVirtualButton("cScanTouchButton"); data = _controlPanel.GetDisplayedStrings(); if (data.Contains("Edit")) { _controlPanel.Press("cEditTouchButton"); Pacekeeper.Pause(); } _controlPanel.ScrollDown(100); var screenText = _controlPanel.GetDisplayedStrings(); if (screenText.Contains("File Name Prefix")) { _controlPanel.Press("cFilenamePrefix"); _executionManager.DeleteFieldData(); _controlPanel.TypeOnVirtualKeyboard(fileName); Pacekeeper.Pause(); _controlPanel.Press(_executionManager.OkayButton); Pacekeeper.Pause(); } } }
/// <summary> /// Enters the "To" email address. /// </summary> /// <param name="emailAddresses">The "To" email addresses.</param> public void EnterToAddress(IEnumerable <string> emailAddresses) { foreach (string address in emailAddresses) { string displayName = address.Split('@')[0]; string emailControlName = $"{displayName} {address}".ToLowerInvariant(); try { if (_controlPanel.GetScreenInfo().ScreenLabels.FirstOrDefault() == "Scan_Email_EmailPageGlass") { switch (AddressSource) { case "Default": { _controlPanel.Press("item1"); //To Address Pacekeeper.Pause(); _controlPanel.WaitForScreenLabel("Scan_Email_AddEmail", _waitTimeSpan); _controlPanel.SetValue("lineedit", address); Pacekeeper.Pause(); _controlPanel.Press("_done"); //Done } break; case "Email Addressbook": { _controlPanel.Press("button2"); _controlPanel.WaitForScreenLabel("Scan_Email_AddressBook", _waitTimeSpan); _controlPanel.PressByValue(displayName, StringMatch.StartsWith); //Check box Pacekeeper.Pause(); _controlPanel.Press("fb_done"); //OK } break; case "LDAP Addressbook": { _controlPanel.Press("email_menu_value_to"); //To Address _controlPanel.WaitForScreenLabel(" view_email_Addressbook_Flow_In_STE_list", TimeSpan.FromSeconds(5)); _controlPanel.Press("Addressbook_Flow_In_STE_footer.3"); //Search Address book _controlPanel.WaitForScreenLabel("view_ldap_search", _shortTimeSpan); _controlPanel.SetValue("ldap_search_enter_search_vkbd.4", displayName); Pacekeeper.Pause(); _controlPanel.WaitForScreenLabel("view_ldap_search_result", _longTimeSpan); _controlPanel.PressByValue(emailControlName); //Check box Pacekeeper.Pause(); _controlPanel.WaitForScreenLabel("view_email_Addressbook_Flow_In_STE_list", _waitTimeSpan); _controlPanel.Press("Addressbook_Flow_In_STE_footer.0"); //Done Pacekeeper.Pause(); } break; } } } catch (ElementNotFoundException ex) { throw new DeviceWorkflowException($"Display name is different from To Address {ex.Message}", ex); } } }
public string GenerateWpsPin() { NavigateToWireless(); _controlPanel.Press("cWirelessWPSSetup"); _pacekeeper.Pause(); if (_controlPanel.GetDisplayedStrings().ToString().Replace("\n", string.Empty).Contains("not available")) { throw new NotSupportedException("Wireless configuration is possible when the printer is in wireless connection"); } _controlPanel.Press("cWirelessGeneratePIN"); IEnumerable <string> items = _controlPanel.GetDisplayedStrings(); string pin = Regex.Match(items.First(x => x.Contains("PIN")), @"\d+").Value; return(pin); }
/// <summary> /// Checks the device control panel for successful authentication. /// </summary> /// <returns> /// <c>true</c> if the authentication operation is valid, <c>false</c> otherwise. /// </returns> public override bool ValidateAuthentication() { if (_engine.WaitForHtmlContains("apps_list_app_title", TimeSpan.FromMilliseconds(20000))) { Thread.Sleep(2000); Pacekeeper.Pause(); return(true); } return(false); }
/// <summary> /// Sets the Orientation - Portrait or Landscape /// </summary> /// <param name="orientation">Orientation type set Potrait or Landscape </param> public void SetOrientation(ContentOrientation orientation) { if (orientation != ContentOrientation.None) { OpenOptionsPanel(); _device.ControlPanel.ScrollPressWait("#hpid-option-content-orientation", "#hpid-option-content-orientation-screen", _activeScreenTimeout); //Selecting Orientation value _device.ControlPanel.ScrollPress(string.Equals(orientation.ToString(), "Portrait", StringComparison.CurrentCultureIgnoreCase) ? "#hpid-content-orientation-selection-portrait" : "#hpid-content-orientation-selection-landscape"); Pacekeeper.Pause(); } }
/// <summary> /// Enters the email subject. /// </summary> /// <param name="subject">The subject.</param> public void EnterSubject(string subject) { if (_controlPanel.WaitForScreenLabel("Scan_Email_EmailPageGlass")) { _controlPanel.Press("item2"); Pacekeeper.Pause(); _controlPanel.SetValue("slineedit", subject);//Keyboard Pacekeeper.Pause(); _controlPanel.Press("_done"); Pacekeeper.Pause(); } }
/// <summary> /// Launches the Email application on the device. /// </summary> public void Launch() { try { _controlPanel.ScrollPress("sfolderview_p", "group.group.scan"); _controlPanel.WaitForScreenLabel("Home", _shortTimeSpan); //Scan To Page Pacekeeper.Pause(); _controlPanel.ScrollPress("sfolderview_p", "command.scan_email"); Pacekeeper.Pause(); _controlPanel.WaitForScreenLabel("Scan_Email_EmailPageGlass", _shortTimeSpan); //Email Page Pacekeeper.Pause(); } catch (ElementNotFoundException ex) { string currentForm = _controlPanel.GetScreenInfo().ScreenLabels.FirstOrDefault(); if (currentForm.Equals("Scan_Status_Error")) { throw new DeviceWorkflowException("Email application button was not found on device home screen.", ex); } else { throw new DeviceWorkflowException($"Cannot launch the Email application from {currentForm}.", ex); } } catch (SiriusInvalidOperationException ex) { switch (_controlPanel.GetScreenInfo().ScreenLabels.FirstOrDefault()) { case "Scan_Email_EmailPageGlass": // The application launched successfully. This happens sometimes. break; case "Scan_Status_Error": { throw new DeviceWorkflowException("Sign-in required to launch the Email application.", ex); } case "Scan_Email_NotSetup": { throw new DeviceWorkflowException("Scan To Email is not configured"); } default: { throw new DeviceWorkflowException($"Could not launch Email application: {ex.Message}", ex); } } } }
private void SetKeyValue(string textBox, string value) { var screenText = ControlPanel.GetDisplayedStrings().ToList(); if (screenText.Contains("Sign In: LDAP") || screenText.Contains("Sign In: Windows")) { ControlPanel.Press(textBox); Thread.Sleep(TimeSpan.FromSeconds(1)); ControlPanel.TypeOnVirtualKeyboard(value); Pacekeeper.Pause(); ControlPanel.Press("cOKTouchButton"); } Pacekeeper.Sync(); }
/// <summary> /// Set Original size of paper /// </summary> /// <param name="sizeType">Set the paper size for Original Size</param> public void SetOriginalSize(OriginalSize sizeType) { if (!sizeType.Equals(OriginalSize.None)) { OpenOptionsPanel(); _device.ControlPanel.ScrollPressWait("#hpid-option-original-size", "#hpid-option-original-size-screen", _activeScreenTimeout); if (_device.ControlPanel.CheckState("#hpid-original-size-selection", OmniElementState.Exists)) { _device.ControlPanel.ScrollPress($"#hpid-original-size-selection-{sizeType.ToString().ToLower()}"); } Pacekeeper.Pause(); } }
/// <summary> /// Creates a speed dial contact /// </summary> public int CreateSpeedDial(string DisplayName, string SpeedDial, string FaxNumber) { int speedDialNumber; _controlPanel.PressWait(".hp-address-book-selection-button", ".hp-contact-record-list"); _controlPanel.PressWait(".hp-listitem:contains(" + "Fax Speed Dials)", ".hp-contact-record-list"); _controlPanel.PressWait("#hpid-contacts-add-record-button", "#hpid-fax-speed-dial-edit-view"); Pacekeeper.Sync(); Pacekeeper.Pause(); if (_controlPanel.WaitForState("#hpid-fax-speed-dial-edit-display-name-textbox", OmniElementState.Useable, TimeSpan.FromSeconds(5))) { _controlPanel.Press("#hpid-fax-speed-dial-edit-display-name-textbox"); } _controlPanel.TypeOnVirtualKeyboard(DisplayName); if (_controlPanel.WaitForState("#hpid-fax-speed-dial-edit-speed-dial-code-textbox", OmniElementState.Useable, TimeSpan.FromSeconds(5))) { _controlPanel.PressWait("#hpid-fax-speed-dial-edit-speed-dial-code-textbox", "#hpid-keypad"); } _controlPanel.TypeOnNumericKeypad(SpeedDial); if (_controlPanel.WaitForState("#hpid-fax-speed-dial-edit-fax-numbers-textbox", OmniElementState.Useable, TimeSpan.FromSeconds(5))) { _controlPanel.PressWait("#hpid-fax-speed-dial-edit-fax-numbers-textbox", "#hpid-keypad"); } _controlPanel.TypeOnNumericKeypad(FaxNumber); if (_controlPanel.WaitForState("#hpid-keypad-key-close", OmniElementState.Useable, TimeSpan.FromSeconds(5))) { _controlPanel.Press("#hpid-keypad-key-close"); } string autoSpeedDial; autoSpeedDial = _controlPanel.GetValue("#hpid-fax-speed-dial-edit-speed-dial-code-textbox", "value", OmniPropertyType.Property); speedDialNumber = int.Parse(autoSpeedDial); _controlPanel.Press("#hpid-fax-speed-dial-edit-save-button"); Pacekeeper.Sync(); Pacekeeper.Pause(); if (_controlPanel.WaitForState(".hp-button-done", OmniElementState.Useable, TimeSpan.FromSeconds(10))) { _controlPanel.Press(".hp-button-done"); _pacekeeper.Pause(); } _preparationManager.NavigateHome(); return(speedDialNumber); }
/// <summary> /// Enters the email subject. /// </summary> /// <param name="subject">The subject.</param> public void EnterSubject(string subject) { if (!string.IsNullOrEmpty(subject)) { _controlPanel.WaitForDisplayedText("From:", StringMatch.Contains, TimeSpan.FromSeconds(6)); string subjBnt = _executionManager.GetButtonName("cSubject"); //"cSubjectXStr"; _controlPanel.Press(subjBnt); _executionManager.DeleteFieldData(); _controlPanel.TypeOnVirtualKeyboard(subject); Pacekeeper.Pause(); _controlPanel.Press(_executionManager.OkayButton); Pacekeeper.Pause(); } }
/// <summary> /// Set the Stamps for Top and Bottom /// </summary> /// <param name="stampList">List containing Key-value Pair for Stamps to be set;Key is the StampType Enum and Value contains string to be set for the Stamptype</param> public void SetStamps(Dictionary <StampType, string> stampList) { OpenOptionsPanel(); _device.ControlPanel.ScrollPressWait("#hpid-option-stamps", "#hpid-option-stamps-select-screen", _activeScreenTimeout); foreach (var item in stampList) { string stamptype = ($"{item.Key.ToString().ToLower()}stamp"); if (_device.ControlPanel.CheckState($"#hpid-stamp-{ stamptype}", OmniElementState.Exists)) { _device.ControlPanel.ScrollPressWait($"#hpid-stamp-{ stamptype}", "#hpid-option-stamp-details-screen", _activeScreenTimeout); if (_device.ControlPanel.CheckState("#hpid-stamp-content-textbox", OmniElementState.Exists)) { _device.ControlPanel.ScrollPress("#hpid-stamp-content-textbox"); Pacekeeper.Pause(); _device.ControlPanel.TypeOnVirtualKeyboard(item.Value.ToString()); _device.ControlPanel.WaitForState("#hpid-keyboard-key-done", OmniElementState.Useable, TimeSpan.FromSeconds(10)); _device.ControlPanel.Press("#hpid-keyboard-key-done"); } if (_device.ControlPanel.WaitForState(".hp-button-done:last", OmniElementState.Useable, _activeScreenTimeout)) { _device.ControlPanel.Press(".hp-button-done:last"); } } } if (_device.ControlPanel.WaitForState(".hp-button-done", OmniElementState.Useable, _activeScreenTimeout)) { _device.ControlPanel.Press(".hp-button-done"); } Pacekeeper.Pause(); }
/// <summary> /// Submits the authentication request. /// </summary> public override void SubmitAuthentication() { try { string okayBtn = (_hpacVersion16_6 == true) ? _footerOkay[1] : _footerOkay[0]; // Press the Oxpd AgentLess done button BoundingBox box = _engine.GetBoundingAreaById(okayBtn); _engine.PressElementByBoundingArea(box); ControlPanel.WaitForForm("HomeScreenForm", TimeSpan.FromSeconds(10)); Pacekeeper.Pause(); } catch (WindjammerInvalidOperationException ex) { switch (ControlPanel.CurrentForm()) { case "OneButtonMessageBox": try { string message = ControlPanel.GetProperty("mMessageLabel", "Text"); if (message.StartsWith("Invalid")) { throw new DeviceWorkflowException($"Could not sign in: {message}", ex); } else { throw new DeviceInvalidOperationException($"Could not sign in: {message}", ex); } } catch (ControlNotFoundException) { throw new DeviceInvalidOperationException($"Could not sign in: {ex.Message}", ex); } default: throw new DeviceInvalidOperationException($"Could not sign in: {ex.Message}", ex); } } }
/// <summary> /// Enters the name to use for the scanned file. /// </summary> /// <param name="fileName">The file name.</param> public void EnterFileName(string fileName) { if (_controlPanel.WaitForDisplayedText("Scan to E-mail", TimeSpan.FromSeconds(1))) { _controlPanel.Press("cJobSettings"); _controlPanel.Press("Scroll Down Arrow"); var screenText = _controlPanel.GetDisplayedStrings().ToList(); if (screenText.Contains("File Name Prefix")) { _controlPanel.Press("cFilenamePrefix"); Pacekeeper.Pause(); var keyTexts = _controlPanel.GetDisplayedStrings().ToList(); int count = keyTexts.ElementAt(0).Count(); for (int i = 0; i < count; i++) { _controlPanel.Press("Del"); } _controlPanel.TypeOnVirtualKeyboard(fileName); _controlPanel.Press("cOKTouchButton"); } } }
/// <summary> /// Submits the authentication request. /// </summary> public override void SubmitAuthentication() { try { // The name of the OK button differs depending on the screen resolution string okButton = ControlPanel.GetControls().Contains("ok") ? "ok" : "mOkButton"; // moved to press wait to handle the no click or no communications with server event within 10 seconds ControlPanel.PressWait(okButton, JediWindjammerLaunchHelper.HOMESCREEN_FORM, TimeSpan.FromSeconds(10)); Pacekeeper.Pause(); } catch (WindjammerInvalidOperationException ex) { switch (ControlPanel.CurrentForm()) { case "OneButtonMessageBox": try { string message = ControlPanel.GetProperty("mMessageLabel", "Text"); if (message.StartsWith("Invalid")) { throw new DeviceWorkflowException($"Could not sign in: {message}", ex); } else { throw new DeviceInvalidOperationException($"Could not sign in: {message}", ex); } } catch (ControlNotFoundException) { throw new DeviceInvalidOperationException($"Could not sign in: {ex.Message}", ex); } default: throw new DeviceInvalidOperationException($"Could not sign in: {ex.Message}", ex); } } }
/// <summary> /// Launches the Email application on the device. /// </summary> public void Launch() { try { _controlPanel.Press("cScanHomeTouchButton"); if (_controlPanel.WaitForDisplayedText("Scan Menu", TimeSpan.FromSeconds(1))) { _controlPanel.Press("cEmailUiEmailDocument"); } Pacekeeper.Pause(); if (_controlPanel.WaitForDisplayedText("Scan to E-mail", TimeSpan.FromSeconds(1))) { _controlPanel.Press("cSendAnEmail"); } } catch (PhoenixInvalidOperationException ex) { throw new DeviceWorkflowException($"Could not launch Email application: {ex.Message}", ex); } }
/// <summary> /// Enters the name to use for the scanned file. /// </summary> /// <param name="fileName">The file name.</param> public void EnterFileName(string fileName) { try { if (_controlPanel.WaitForScreenLabel("Scan_Email_EmailPageGlass")) { _controlPanel.Press("item3"); Pacekeeper.Pause(); _controlPanel.SetValue("slineedit", fileName);//Keyboard Pacekeeper.Pause(); _controlPanel.Press("_done"); Pacekeeper.Pause(); } } catch (ElementNotFoundException) { //in small screen the option to set filename is missing, so ignore this //throw new DeviceWorkflowException($"Display name is different from To Address {ex.Message}", ex); } }
/// <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; } }
/// <summary> /// Enters UserName and Password for Oxpd Login. /// </summary> private void EnterUserNamePassword() { if (ControlPanel.WaitForActiveScreenLabel("view_sips_form", _defaultWait)) { if (!string.IsNullOrEmpty(Credential.Domain)) { //press the button beside domain ControlPanel.Press("sips_form_region1_value"); ControlPanel.WaitForActiveScreenLabel("view_sips_form_entry_region2", _defaultWait); Pacekeeper.Pause(); ControlPanel.SetValue("sips_form_region1_kbd.4", Credential.Domain); ControlPanel.WaitForActiveScreenLabel("view_sips_form", _defaultWait); Pacekeeper.Pause(); } // press the button beside User Login button ControlPanel.Press("sips_form_region2_value"); ControlPanel.WaitForActiveScreenLabel("view_sips_form_entry_region2", _defaultWait); Pacekeeper.Pause(); ControlPanel.SetValue("sips_form_region2_kbd.4", Credential.UserName); ControlPanel.WaitForActiveScreenLabel("view_sips_form", _defaultWait); Pacekeeper.Pause(); // press the button beside the Password button ControlPanel.Press("sips_form_region3_value"); ControlPanel.WaitForActiveScreenLabel("view_sips_form_region3_kbd", _defaultWait); Pacekeeper.Pause(); ControlPanel.SetValue("sips_form_region3_kbd.4", Credential.Password); ControlPanel.WaitForActiveScreenLabel("view_sips_form", _defaultWait); Pacekeeper.Pause(); } else { throw new DeviceInvalidOperationException("Unable to enter credentials. Not at device sign in screen."); } }
/// <summary> /// Launches the Workflow application on the device. /// </summary> public void Launch() { string appButton = FindWorkflowAppButton(); try { RecordEvent(DeviceWorkflowMarker.AppButtonPress, "DssWorkflow"); bool launched = _controlPanel.ScrollPressWait("mAccessPointDisplay", appButton, "OxpBaseForm|OxpUIAppMainForm.*", StringMatch.Regex); if (launched) { RecordEvent(DeviceWorkflowMarker.AppShown); Pacekeeper.Pause(); } else { string currentForm = _controlPanel.CurrentForm(); switch (currentForm) { case "SignInForm": throw new DeviceWorkflowException("Sign-in required to launch the Workflow application."); case "OneButtonMessageBox": case "OxpDialogForm": string message = _controlPanel.GetProperty("mMessageLabel", "Text"); throw new DeviceWorkflowException($"Could not launch Workflow application: {message}"); default: throw new DeviceWorkflowException($"Could not launch Workflow application. Current form: {currentForm}"); } } } catch (WindjammerInvalidOperationException ex) { throw new DeviceWorkflowException($"Could not launch Workflow application: {ex.Message}", ex); } if (_controlPanel.CurrentForm() == "OxpBaseForm") { // Legacy workflow - wait for the workflows to finish loading Wait.ForNotNull(FindWorkflowMenuTree, TimeSpan.FromSeconds(10)); } }
public void SelectLanguage(Languages language) { try { string code = Properties.JediResources.ResourceManager.GetString(language.ToString()); _pacekeeper.Pause(); _device.ControlPanel.PressKey(JediHardKey.Menu); _pacekeeper.Pause(); _device.ControlPanel.PressToNavigate("mLanguageSelectButton", "QuickLanguageSelectionDialog", true); _pacekeeper.Pause(); _device.ControlPanel.Press(code); _pacekeeper.Pause(); _device.ControlPanel.Press("m_OKButton"); _pacekeeper.Pause(); _device.ControlPanel.PressKey(JediHardKey.Menu); } catch (Exception e) { throw new DeviceWorkflowException($"Selecting language failed with exception:{e.Message}"); } }
/// <summary> /// Launches the Email application using the specified authenticator and authentication mode. /// </summary> /// <param name="authenticator">The authenticator.</param> /// <param name="authenticationMode">The authentication mode.</param> public void Launch(IAuthenticator authenticator, AuthenticationMode authenticationMode) { if (authenticationMode.Equals(AuthenticationMode.Lazy)) { try { _controlPanel.ScrollPress("sfolderview_p", "group.group.scan"); _controlPanel.WaitForScreenLabel("Home", _shortTimeSpan); //Scan To Page Pacekeeper.Pause(); _controlPanel.ScrollPress("sfolderview_p", "command.scan_email"); Pacekeeper.Pause(); if (!_controlPanel.WaitForScreenLabel("Scan_Email_EmailPageGlass", _shortTimeSpan)) { //if there are two sender's profile, we will have this intermediate screen which needs to be handled, selecting the first one as default if (_controlPanel.WaitForScreenLabel("Scan_Email_SenderProfile", _shortTimeSpan)) { _controlPanel.Press("model.ScanEmailProfilesModel.0"); Pacekeeper.Pause(); } if (_controlPanel.WaitForScreenLabel("AnA_Login_With_Windows_Authentication", _shortTimeSpan) || _controlPanel.WaitForScreenLabel("AnA_Login_With_LDAP_Authentication", _shortTimeSpan)) //Scan To Page { Pacekeeper.Pause(); } } if (_controlPanel.GetScreenInfo().ScreenLabels.FirstOrDefault() != "Scan_Email_EmailPageGlass") { if (authenticator == null) { throw new DeviceWorkflowException("Credentials are not supplied"); } authenticator.Authenticate(); } _controlPanel.WaitForScreenLabel("Scan_Email_EmailPageGlass", _longTimeSpan); //Email Form Pacekeeper.Pause(); } catch (ElementNotFoundException ex) { string currentForm = _controlPanel.GetScreenInfo().ScreenLabels.FirstOrDefault(); if (currentForm.Equals("Home")) { throw new DeviceWorkflowException($"Email application button was not found on device home screen.", ex); } else { throw new DeviceWorkflowException($"Cannot launch the Email application from {currentForm}.", ex); } } catch (SiriusInvalidOperationException ex) { switch (_controlPanel.GetScreenInfo().ScreenLabels.FirstOrDefault()) { case "Scan_Email_EmailPageGlass": // The application launched successfully. This happens sometimes. break; case "AnA_Login_With_Windows_Authentication;AnA_Login_With_LDAP_Authentication": { throw new DeviceWorkflowException($"Sign-in required to launch the Email application.", ex); } case "Scan_Email_NotSetup": { throw new DeviceWorkflowException("Scan To Email is not configured"); } default: { throw new DeviceWorkflowException($"Could not launch Email application: {ex.Message}", ex); } } } } else // AuthenticationMode.Eager { throw new NotImplementedException("Eager Authentication has not been implemented in SiriusUIv3EmailApp."); } }