/// <summary> /// Sets the time to the specified time. /// </summary> /// <param name="time"> /// The time to set. /// </param> public void SetTime(TimeSpan time) { // Taps the time picker to show the popup. this.Element.Click(); // Finds the popup and changes the time. WindowsElement popup = this.Driver.FindElement(this.flyoutQuery); popup.FindElement(this.hourSelectorQuery).FindElementByName(time.ToString("%h")).Click(); popup.FindElement(this.minuteSelectorQuery).FindElementByName(time.ToString("mm")).Click(); popup.FindElement(this.acceptButtonQuery).Click(); }
/// <summary> /// Sets the date to the specified date. /// </summary> /// <param name="date">The date to set.</param> public void SetDate(DateTime date) { // Taps the time picker to show the popup. this.Element.Click(); // Finds the popup and changes the time. WindowsElement popup = this.Driver.FindElement(this.flyoutQuery); popup.FindElement(this.daySelectorQuery).FindElementByName(date.ToString("%d")).Click(); popup.FindElement(this.monthSelectorQuery).FindElementByName(date.ToString("MMMM")).Click(); popup.FindElement(this.yearSelectorQuery).FindElementByName(date.ToString("yyyy")).Click(); popup.FindElement(this.acceptButtonQuery).Click(); }
/// <summary> /// Finds an element within the <paramref name="element"/> with the given <paramref name="automationId"/>. /// </summary> /// <param name="element">The element to search.</param> /// <param name="automationId">The automation ID associated with the element to locate.</param> /// <returns>The located <see cref="AppiumWebElement"/>.</returns> public static AppiumWebElement FindElementByAutomationId(this WindowsElement element, string automationId) { return(element.FindElement(ByExtensions.AutomationId(automationId))); }