/// <summary>
        /// Waits until the element targeted by the given query appears, and then returns the query to this element
        /// </summary>
        /// <param name="query">The current query</param>
        /// <param name="waitFor">The query that defines the element that is awaited</param>
        /// <returns>The query to the awaited element</returns>
        public static QueryEx WaitForAndAcquire(this QueryEx query, Func <QueryEx, QueryEx> waitFor)
        {
            var target = waitFor(QueryExFactory.BlankQuery());

            WaitUntilExists(target);

            return(target);
        }
 /// <summary>
 /// Waits until the element targeted by the given query appears
 /// </summary>
 /// <param name="query">The current query</param>
 /// <param name="waitFor">The query that defines the element that is awaited</param>
 public static void WaitFor(this QueryEx query, Func <QueryEx, QueryEx> waitFor, TimeSpan?timeout = null)
 {
     App.WaitForElement(waitFor(QueryExFactory.BlankQuery()), timeout: timeout);
 }
示例#3
0
        public static QueryEx CreateQuery(this IApp app)
        {
            app.Initialize();

            return(QueryExFactory.BlankQuery());
        }
示例#4
0
 /// <summary>
 /// Successively execute the given set of queries until one of them yields one or more results, in which case this query is returned.
 /// If none of the given queries yield any result,
 /// </summary>
 /// <param name="app">The application</param>
 /// <param name="candidates">The set of candidate queries, each of which will be executed sequentialy until one yields one or more results</param>
 /// <returns>The first query which yielded one or more results</returns>
 public static QueryEx TryAcquire(this IApp app, params Func <QueryEx, QueryEx>[] candidates)
 {
     return(QueryExFactory.BlankQuery().TryAcquire(candidates));
 }
示例#5
0
 /// <summary>
 /// Attempts to find an element matching the <see cref="to"/> query, scrolling DOWN if necessary
 /// </summary>
 /// <param name="app">The application</param>
 /// <param name="to">The query transform that indicates the element that is searched for"/></param>
 /// <param name="timeout">[Optionnal] An explicit value for the timeout. If not specified, the default timeout  will be used.</param>
 /// <returns>A query pointing to the resulting element if it was found</returns>
 public static QueryEx Find(this IApp app, Func <QueryEx, QueryEx> to, TimeSpan?timeout = null)
 {
     return(app.Find(QueryExFactory.BlankQuery().Transform(to), timeout));
 }
示例#6
0
 /// <summary>
 /// Creates a query that targets any element marked with the give value
 /// </summary>
 /// <param name="app">The application</param>
 /// <param name="marked">The mark of the element that is searched for</param>
 /// <returns>A query that targets any element marked with the give value</returns>
 public static QueryEx Marked(this IApp app, string marked)
 {
     return(QueryExFactory.BlankQuery().Marked(marked));
 }
示例#7
0
 /// <summary>
 /// Attempts to find an element matching the <see cref="to"/> query, scrolling up on
 /// the element matching the <see cref="within"/> query if necessary
 /// </summary>
 /// <param name="app">The application</param>
 /// <param name="to">The query that indicates the element that is searched for within <see cref="within"/></param>
 /// <param name="within">The query that indicates the element where any scrolling required to reach the element will occur</param>
 /// <param name="timeout">[Optionnal] An explicit value for the timeout. If not specified, the default timeout  will be used.</param>
 /// <returns>A query pointing to the resulting element if it was found</returns>
 public static QueryEx FindUpwardsWithin(this IApp app, Func <QueryEx, QueryEx> to, QueryEx within, TimeSpan?timeout = null)
 {
     return(app.FindUpwardsWithin(QueryExFactory.BlankQuery().Transform(to), within, timeout: timeout));
 }
示例#8
0
 /// <summary>
 /// Attempts to find an element matching the <see cref="to"/> query, scrolling down on
 /// the element matching the <see cref="within"/> query if necessary
 /// </summary>
 /// <param name="app">The application</param>
 /// <param name="to">The query transform that indicates the element that is searched for within <see cref="within"/></param>
 /// <param name="within">The query transform that indicates the element where any scrolling required to reach the element will occur</param>
 /// <param name="timeout">[Optionnal] An explicit value for the timeout. If not specified, the default timeout  will be used.</param>
 /// <returns>A query pointing to the resulting element if it was found</returns>
 public static QueryEx FindWithin(this IApp app, Func <QueryEx, QueryEx> to, Func <QueryEx, QueryEx> within, TimeSpan?timeout = null)
 {
     return(app.FindWithin(to, within(QueryExFactory.BlankQuery()), timeout: timeout));
 }
示例#9
0
 public static QueryEx FindWithin(this IApp app, string marked, QueryEx within, TimeSpan?timeout = null)
 {
     return(app.FindInternal(QueryExFactory.BlankQuery().Marked(marked), within, timeOut: timeout));
 }
示例#10
0
        /// <summary>
        /// Attempts to find an element matching the <see cref="to"/> query, scrolling down on
        /// the element matching the <see cref="within"/> query if necessary
        /// </summary>
        /// <param name="app">The application</param>
        /// <param name="to">The query transform that indicates the element that is searched for within <see cref="within"/></param>
        /// <param name="within">The query that indicates the element where any scrolling required to reach the element will occur</param>
        /// <param name="timeout">[Optionnal] An explicit value for the timeout. If not specified, the default timeout  will be used.</param>
        /// <returns>A query pointing to the resulting element if it was found</returns>
        public static QueryEx FindWithin(this IApp app, Func <QueryEx, QueryEx> to, QueryEx within, TimeSpan?timeout = null)
        {
            var target = QueryExFactory.BlankQuery().Transform(to);

            return(app.FindInternal(target, within, timeOut: timeout));
        }