swati_nadage
10 years agoContributor
Not able to click on button whose enabled proprty is false.
We have a button in our application whose enabled property is false hence not able to click on button. It's giving "The window is disabled. The action cannot be executed."
I tried using keystrokes, setting focus etc but as its enabled property is false Test complete is throwing error when trying to use click method on button.
Could you please let us know how to click on such button.
There are a couple ways you could do this, but why on earth are you having it click a disabled window? :)
Anyhow....you could try something like this...
function main() { var object = //your button here clickobject(object); } function clickobject(object){ var x = object.screenleft + (object.width / 2); var y = object.screentop + (object.height / 2); setparentfocus(object); LLPlayer.MouseDown(1, x, y, 0); LLPlayer.MouseUp(1, x, y, 0); } function setparentfocus(object) { while (object["parent"]) { if (propExists(object.parent, 'SetFocus')) { object.parent.SetFocus(); } object = object.parent; } }