Provides a mechanism to find Rendered Elements on the page
Inheritance: RemoteWebElement, IRenderedWebElement
        /// <summary>
        /// Creates a <see cref="RemoteWebElement"/> with the specified ID.
        /// </summary>
        /// <param name="elementId">The ID of this element.</param>
        /// <returns>A <see cref="RemoteWebElement"/> with the specified ID.</returns>
        protected virtual RemoteWebElement CreateElement(string elementId)
        {
            RemoteWebElement toReturn;

            if (capabilities.IsJavaScriptEnabled)
            {
                toReturn = new RenderedRemoteWebElement(this, elementId);
            }
            else
            {
                toReturn = new RemoteWebElement(this, elementId);
            }

            return(toReturn);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RemoteCoordinates"/> class.
 /// </summary>
 /// <param name="element">The <see cref="RenderedRemoteWebElement"/> used to show the coordinates.</param>
 public RemoteCoordinates(RenderedRemoteWebElement element)
 {
     this.element = element;
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RemoteCoordinates"/> class.
 /// </summary>
 /// <param name="element">The <see cref="RenderedRemoteWebElement"/> used to show the coordinates.</param>
 public RemoteCoordinates(RenderedRemoteWebElement element)
 {
     this.element = element;
 }
        /// <summary>
        /// Creates a <see cref="RemoteWebElement"/> with the specified ID.
        /// </summary>
        /// <param name="elementId">The ID of this element.</param>
        /// <returns>A <see cref="RemoteWebElement"/> with the specified ID.</returns>
        protected virtual RemoteWebElement CreateElement(string elementId)
        {
            RemoteWebElement toReturn;
            if (this.capabilities.IsJavaScriptEnabled)
            {
                toReturn = new RenderedRemoteWebElement(this, elementId);
            }
            else
            {
                toReturn = new RemoteWebElement(this, elementId);
            }

            return toReturn;
        }
Beispiel #5
0
        private RemoteWebElement CreateRemoteWebElement()
        {
            RemoteWebElement toReturn;
            if (capabilities.IsJavaScriptEnabled)
            {
                toReturn = new RenderedRemoteWebElement();
            }
            else
            {
                toReturn = new RemoteWebElement();
            }

            toReturn.Parent = this;
            return toReturn;
        }
Beispiel #6
0
        private void AmendElementValueIfNecessary(Response commandResponse)
        {
            if (!(commandResponse.Value is RemoteWebElement))
            {
                return;
            }

            // Ensure that the parent is set properly
            RemoteWebElement existingElement = (RemoteWebElement)commandResponse.Value;
            existingElement.Parent = this;

            if (!Capabilities.IsJavaScriptEnabled)
            {
                return;
            }

            if (!(commandResponse.Value is RenderedRemoteWebElement))
            {
                return; // Good, nothing to do}
            }

            RenderedRemoteWebElement replacement = new RenderedRemoteWebElement();
            replacement.Id = existingElement.Id;
            replacement.Parent = this;

            commandResponse.Value = replacement;
        }