/// <summary> /// Launches the Workflow application on the device. /// </summary> public void Launch() { bool appLoaded = false; // The button ID uses a generated identifier which always starts with the same GUID string appButtonId = _controlPanel.GetIds("[id^=hpid-1c043000]", OmniIdCollectionType.Self).FirstOrDefault(); if (appButtonId != null) { RecordEvent(DeviceWorkflowMarker.AppButtonPress, "DSS Workflow"); appLoaded = _controlPanel.ScrollPressWait($"#{appButtonId}", "#hpid-oxpd-scroll-pane", TimeSpan.FromSeconds(10)); RecordEvent(DeviceWorkflowMarker.AppShown); Pacekeeper.Pause(); } else { throw new DeviceWorkflowException("DSS Workflow application button was not found on device home screen."); } if (!appLoaded) { if (_controlPanel.CheckState("#hpid-signin-app-screen", OmniElementState.Exists)) { throw new DeviceWorkflowException("Sign-in required to launch the DSS Workflow application."); } else { throw new DeviceWorkflowException("Could not launch DSS Workflow application."); } } }
public bool ConfigureWirelessStation(string ssid, WirelessModes wirelessMode, WirelessStaModes mode, WirelessBands band, WirelessAuthentications auth, string passphrase, int keyIndex) { NavigateToWireless(); // Wireless mode _controlPanel.PressWait(GetControlId("WIRELESS STATION", "li"), "#hpid-settings-app-menu-panel .hp-listitem-text:contains(Status)"); List <string> controls = _controlPanel.GetIds("li", OmniIdCollectionType.Self).ToList(); // Status _controlPanel.PressWait(GetControlId("Status", controls: controls), "#0"); _controlPanel.Press($"#0"); _controlPanel.PressWait("#hpid-ok-setting-button", GetControlId("SSID", controls: controls)); // Enter ssid _controlPanel.PressWait(GetControlId("SSID", controls: controls), "#hpid-dynamic-setting-panel .hp-dynamic-text-box:contains()"); _controlPanel.PressWait($"#hpid-dynamic-setting-panel .hp-dynamic-text-box", "#hpid-keyboard"); _controlPanel.TypeOnVirtualKeyboard(ssid); _controlPanel.PressWait("#hpid-keyboard-key-done", "#hpid-ok-setting-button"); _controlPanel.PressWait("#hpid-ok-setting-button", GetControlId("AUTHENTICATION", controls: controls)); // Authentication _controlPanel.PressWait(GetControlId("AUTHENTICATION", controls: controls), "#0"); _controlPanel.Press($"#{(int)auth}"); _controlPanel.PressWait("#hpid-ok-setting-button", GetControlId("AUTHENTICATION", controls: controls)); NavigateHome(); return(true); }
/// <summary> /// Press Done button when UI display the keyboard /// </summary> private void PressDoneOnVirtualKeyboard() { List <string> controls = _controlPanel.GetIds("Div", OmniIdCollectionType.Children).ToList(); if (controls.Contains("hpid-keyboard-key-done")) { if (_controlPanel.WaitForAvailable("#hpid-keyboard-key-done")) { _controlPanel.Press("#hpid-keyboard-key-done"); } } }
/// <summary> /// Authenticates the user for HEEC. /// </summary> /// <param name="authenticator">The authenticator.</param> /// <returns>true on success</returns> private bool Authenticate(IAuthenticator authenticator) { bool bSuccess = false; try { authenticator.Authenticate(); bSuccess = true; } catch (ElementNotFoundException ex) { List <string> currentForm = _controlPanel.GetIds("hp-smart-grid", OmniIdCollectionType.Children).ToList(); if (currentForm.Contains("HomeScreenForm")) { throw new DeviceWorkflowException("The HPAC application button was not found on device home screen.", ex); } else { throw new DeviceInvalidOperationException(string.Format("Could not launch the HPAC application from {0}.", currentForm), ex); } } catch (OmniInvalidOperationException ex) { throw new DeviceInvalidOperationException(string.Format("Could not launch the HPAC application: {0}", ex.Message), ex); } return(bSuccess); }
/// <summary> /// Searches for ISecStar Print Option and Presses the Print Option. /// </summary> /// <param name="waitForm"></param> private void PressISecStarSolutionButton(string waitForm) { string elementId = string.Empty; List <string> controls = _controlPanel.GetIds("Div", OmniIdCollectionType.Children).ToList(); foreach (string controlId in controls) { if (_controlPanel.GetValue('#' + controlId, "innerText", OmniPropertyType.Property).Equals("Print")) { elementId = '#' + controlId; break; } } if (!_controlPanel.WaitForState(".hp-oxpd-app-screen", OmniElementState.Useable, TimeSpan.FromSeconds(5))) { RecordEvent(DeviceWorkflowMarker.AppButtonPress, iSecStarResource.SolutionButtonTitle); _controlPanel.PressWait(elementId, waitForm); } }
private string FindFileTypeListItem(string fileType, string listItemSelector) { var matchingIds = _controlPanel.GetIds(listItemSelector, OmniIdCollectionType.Self).Select(n => $"#{n}"); switch (matchingIds.Count()) { case 0: throw new DeviceWorkflowException($"Could not find file type option for '{fileType}'."); case 1: return(matchingIds.First()); default: // If there is more than one match, find the one whose text is an exact match. return(matchingIds.First(n => fileType == _controlPanel.GetValue($"{n} .hp-listitem-text", "innerText", OmniPropertyType.Property))); } }
/// <summary> /// Swipes to button. /// </summary> /// <param name="elementId">The element identifier.</param> /// <returns>bool</returns> private bool SwipeToButton(string elementId) { bool success = true; List <string> controls = _controlPanel.GetIds(elementId, OmniIdCollectionType.Self).ToList(); if (controls.Count == 1) { elementId = "#" + controls[0]; RecordEvent(DeviceWorkflowMarker.AppButtonPress, _solutionButton); success = _controlPanel.ScrollPressWait(elementId, JediOmniLaunchHelper.LazySuccessScreen); } else { success = false; } return(success); }
internal void Exercise(DirtyDeviceActivityData activityData) { const string AppButtonFilter = "-homescreen-button"; var controls = _controlPanel.GetIds("div", OmniIdCollectionType.Children).Where(id => id.EndsWith(AppButtonFilter)).ToArray(); _owner.OnUpdateStatus(this, $"Found {controls.Length} app buttons..."); for (int controlIndex = 0; controlIndex < controls.Length; controlIndex++) { string controlSelector = "#" + controls[controlIndex]; string innerText = _controlPanel.GetValue(controlSelector, "innerText", OmniPropertyType.Property).Trim(); _controlPanel.ScrollToItem(controlSelector); if (_controlPanel.WaitForState(controlSelector, OmniElementState.Useable, TimeSpan.FromSeconds(10))) { _owner.OnUpdateStatus(this, $" Pressing {innerText} ({controlIndex + 1:##}/{controls.Length:##})"); _controlPanel.Press(controlSelector); } else { _owner.OnUpdateStatus(this, $" Skipping {innerText}. App is not available currently. ({controlIndex + 1:##}/{controls.Length:##})"); continue; } System.Threading.Thread.Sleep(5000); try { _preparationManager.Reset(); } catch (Exception x) { _owner.OnUpdateStatus(this, x.ToString()); _owner.OnUpdateStatus(this, $" Pressing 'Home' button did not exit {innerText}. Consider filing a bug report against the app."); _owner.OnUpdateStatus(this, $" Attempting to return to home screen by waiting for timeout."); UnauthenticateByTimeout(); } } }
/// <summary> /// Gets the current control ids. /// </summary> public override void GetCurrentControlIds() { ProcessControlIds(_controlPanel.GetIds(null, OmniIdCollectionType.Descendants)); }