Search code examples
buttonclickwatin

How to determine if a button is clickable?


I have a form for which I try to write some tests. I have a problem, however: Is there any way to check, if a button is clickable or if it is "greyed out"? I tried looking for something like "Elements.IsActive", or "Clickable", but nothing is there.

I know that WatiN can throw an exception if it tries to click a button that isn't active, so there just HAS to be a way to check it before clicking it...

Can anyone help me out here?


Solution

  • if( browser.Button("id").Enabled)
    
        Console.Write("Enabled");
    
    else
    
        Console.Write("Disabled");
    

    you can try this.