Exemplo n.º 1
0
        /// <summary>
        /// A condition that waits until the qooxdoo application in the browser is
        /// ready (<code>qx.core.Init.getApplication()</code> returns anything truthy).
        /// </summary>
        public Func <IWebDriver, bool> QxAppIsReady()
        {
            return(driver =>
            {
                object result = null;
#if !DEBUGJS
                string script = JavaScript.Instance.GetValue("isApplicationReady");
                try
                {
                    result = JsExecutor.ExecuteScript(script);
                }
                catch (WebDriverException)
                {
                }
#else
                try
                {
                    result = JsRunner.RunScript("isApplicationReady");
                }
                catch (WebDriverException)
                {
                }
#endif
                var isReady = result != null && (bool)result;
                return isReady;
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WidgetImpl"/> class.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="webDriver">The web driver.</param>
        public WidgetImpl(IWebElement element, QxWebDriver webDriver)
        {
            Driver = webDriver;

            JsExecutor = Driver.JsExecutor;
            JsRunner   = Driver.JsRunner;

            _contentElement = (IWebElement)JsRunner.RunScript("getContentElement", element);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns a <seealso cref="IWidget" /> representing a child control of this widget.
        /// </summary>
        /// <param name="childControlId">The child control identifier.</param>
        /// <returns>
        /// The matching child widget or <c>null</c> if the child control doesn't exist.
        ///.</returns>
        public virtual IWidget GetChildControl(string childControlId)
        {
            if (childControlId == null)
            {
                throw new ArgumentNullException(nameof(childControlId));
            }

            object      result  = JsRunner.RunScript("getChildControl", _contentElement, childControlId);
            IWebElement element = (IWebElement)result;

            if (element == null)
            {
                return(null);
            }

            return(Driver.GetWidgetForElement(element));
        }