Button pressed using winrunner

I want to know whether a button is pressed by the user or not. I want to use this in an if statement. Does any1 know about this? Please help

Questions by agarwalankur

Showing Answers 1 - 9 of 9 Answers

yes u can check the status of the button ,u need to take the info from the application and u need to compare it with the actual value.

say u have a OK button which is enabled, u need to check whether its enabled or not.

u can write a fnction

public function button_check(in object, in status)
{
auto value;

button_get_info(object,"enabled",value);

if(status==value)

{

tl_step("button status check",PASS,"button is enabled");
return E_OK;
}
else
{
tl_step("button status check",FAIL,"button is not enabled");
return E_GENERAL_ERROR;
}
}

call this function

button_check("OK","1")

any doubts pls revert

  Was this answer useful?  Yes

I think the answer mentioned above is wrong.
As above script checks whether the button is enbled or disabled and not the button is pressed or not.
As pressing button does not necesarily disbled it.

  Was this answer useful?  Yes

a_katiyar

  • Aug 28th, 2008
 

Checking button wether it was pressed or not depends on behavior of button when pressed, its correct we can not always check the state of button, but if button is changing its state from enabled to disabled then the function mentioned in first answer can be used.
Else we can also check what are the changes happening after pressing the button (say color of button, button label, any pop-up, any other updation on page/application, any updation in database etc.) to make sure button was pressed.

Regards,
-AK

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions