/// <summary> /// Returns the widget identified by the specified <para>path</para>. /// </summary> /// <param name="path">The path string.</param> /// <param name="timeoutInSeconds">The number of seconds to wait for the widget (default is 5).</param> /// <returns>The <see cref="IWidget"/> that matches the <para>path</para>.</returns> public IWidget FindWidget(string path, int timeoutInSeconds = 5) { var key = "$/" + path; return(Cache(key, () => { var widgetBy = By.Qxh(By.Namespace(path)); var widget = FindWidget(widgetBy, timeoutInSeconds); return widget; })); }
/// <summary> /// Returns the child widget identified by the specified <para>path</para>. /// </summary> /// <param name="parent">The parent widget.</param> /// <param name="path">The path string.</param> /// <param name="timeoutInSeconds">The number of seconds to wait for the widget (default is 5).</param> /// <returns>The child <see cref="IWidget"/> that matches the <para>path</para>.</returns> public IWidget FindChildWidget(IWidget parent, string path, int timeoutInSeconds = 5) { var key = parent.QxHash + "/" + path; return(Cache(key, () => { var widgetBy = By.Qxh(By.Namespace(path)); var widget = parent.WaitForWidget(widgetBy, timeoutInSeconds); return widget; })); }
/// <summary> /// Finds the first selectable TreeNode widget with a label matching the regular /// expression and returns it /// </summary> /// <param name="regex">The regular expression to match.</param> /// <returns>The matching TreeNode.</returns> public virtual IWidget GetSelectableItem(string regex) { QX.By itemLocator = QX.By.Qxh("*/[@label=" + regex + "]"); IWebElement target = null; try { target = ContentElement.FindElement(itemLocator); } catch (NoSuchElementException) { } if (target != null) { return(Driver.GetWidgetForElement(target)); } return(null); }