public WebElementInstance FindElement(SearchContextInstance searchContext)
        {
            if (searchContext == null)
            {
                throw new JavaScriptException(this.Engine, "Error", "A Search Context must be specified.");
            }

            var result = m_by.FindElement(searchContext.SearchContext);

            return(new WebElementInstance(this.Engine.Object.InstancePrototype, result));
        }
        public ArrayInstance FindElements(SearchContextInstance searchContext)
        {
            if (searchContext == null)
            {
                throw new JavaScriptException(this.Engine, "Error", "A Search Context must be specified.");
            }

            var result      = m_by.FindElements(searchContext.SearchContext);
            var resultArray = this.Engine.Array.Construct();

            foreach (var r in result)
            {
                ArrayInstance.Push(resultArray, new WebElementInstance(this.Engine.Object.InstancePrototype, r));
            }

            return(resultArray);
        }