/// <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)); }
/// <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)); }
/// <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); }
/// <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); }
/// <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); }
public void TearDownMainControl() { ControlRootExtension.TearDownRoot(); }