CUITe Enabled Property Bug

Aug 21, 2013 at 3:25 PM
Hello there,
I was looking to use the Enabled property on CUITe_HtmlInputButton's (or any other control type) but I was unable to use it for checking if a given control is disabled.

It looks like under the hood the Enabled property code (in CUITe_ControlBase.cs) waits for the control to be "ready" before returning the underlying _control.Enabled value. Unless I'm mistaken this prevents the Enabled property from ever returning false, and when the control is disabled it times out waiting and throws an exception.

To fix this, on my end I changed:
 public bool Enabled
        {
            get 
            {
                this._control.WaitForControlReady();
                return this._control.Enabled; 
            }
        }
to
 public bool Enabled
        {
            get 
            {
                //This will wait 5 seconds for the control to be ready before returning the property
                this._control.WaitForControlReady(5000);
                return this._control.Enabled; 
            }
        }
Do you know of any unintentional impact this change may have? Is this something that could be added to the framework? Thanks!
Coordinator
Aug 24, 2013 at 7:23 PM
Hi yourmaster27,

I was not able to reproduce your issue.

The following coded ui test passes and completes in about 4 seconds:
        [TestMethod]
        public void Enabled_OnDisabledHtmlInputButton_ReturnsFalse()
        {
            //Arrange
            using (TempFile tempFile = new TempFile(
@"<html>
    <head>
        <title>test</title>
    </head>
    <body>
        <input name=""inputName"" type=""submit"" value=""Click here"" disabled=""disabled"" />
    </body>
</html>"))
            {
                CUITe_BrowserWindow.Launch(tempFile.FilePath);
                CUITe_BrowserWindow window = new CUITe_BrowserWindow("test");

                CUITe_HtmlInputButton button = window.Get<CUITe_HtmlInputButton>("Value=Click here");

                //Act
                Assert.IsFalse(button.Enabled);

                window.Close();
            }
        }