Exemple #1
0
        /// <summary>
        /// Navigates to the element through the given path, reads
        /// </summary>
        /// <param name="parentnode"></param>
        /// <param name="path">Member name path to the control starting at the main control</param>
        /// <returns>IHTMLElement wrapper</returns>
        private static HTMLElement GetHTMLElement(this IIE inst, Control parentnode, string path)
        {
            if (ControlRootExtension.GetRoot() == null)
            {
                throw new InvalidOperationException("IE tests must run in the w3wp.exe address space");
            }
            var control = GetControl(inst, ControlRootExtension.GetRoot(), path);

            return(GetHTMLElement(inst, control.ClientID));
        }
Exemple #2
0
 /// <summary>
 /// Returns the ASP.NET control instance at the given path
 /// </summary>
 /// <param name="path">Member name path to the control starting at the main control</param>
 /// <returns>ASP.NET control</returns>
 public static Control GetControl(this IIE inst, string path)
 {
     return(GetControl(inst, ControlRootExtension.GetRoot(), path));
 }
Exemple #3
0
        /// <summary>
        /// Write into the ASP.NET control (usually a TextBox instance) at the given path
        /// </summary>
        /// <param name="path">Member name path to the control starting at the main control</param>
        /// <param name="text">Text to write</param>
        public static void Write(this IIE inst, string path, string text)
        {
            var input = GetHTMLElement(inst, ControlRootExtension.GetRoot(), path);

            input.setAttribute("value", text);
        }
Exemple #4
0
        /// <summary>
        /// Click the ASP.NET control element (usually a Button instance) at the given path and wait for the response
        /// when expectPostBack is true.
        /// </summary>
        /// <param name="path">Member name path to the control starting at the main control</param>
        /// <param name="expectPostBack">Whether to expect a server request from the click</param>
        /// <param name="expectedStatusCode">Expected StatusCofe of the response</param>
        /// <param name="delay">Optional delay time in milliseconds before clicking the element</param>
        /// <param name="pause">Optional pause time in milliseconds after IE claims DocumentComplete</param>
        public static void Click(this IIE inst, string path, bool expectPostBack = true, int expectedStatusCode = 200, int delay = 0, int pause = 0)
        {
            var button = GetHTMLElement(inst, ControlRootExtension.GetRoot(), path);

            IEExtensionBase.Click(button, expectPostBack, expectedStatusCode, delay, pause);
        }
Exemple #5
0
        /// <summary>
        /// Write into the ASP.NET control (usually a TextBox instance) at the given path
        /// </summary>
        /// <param name="path">Member name path to the control starting at the main control</param>
        /// <param name="text">Text to write</param>
        /// <param name="throttle">Time interval in milliseconds between sending chars to a text input when > 0</param>
        public static void Write(this ISelenium inst, string path, string text, int throttle = 0)
        {
            var textinput = GetHTMLElement(inst, ControlRootExtension.GetRoot(), path);

            SeleniumExtensionBase.SendKeys(textinput, text, throttle);
        }
Exemple #6
0
 public void TearDownMainControl()
 {
     ControlRootExtension.TearDownRoot();
 }