1

Is there a way to find if a link is disabled in QTP? for textboxs and buttons it is easy, we can use GetROProperty and then give the property as disabled or ediable, etc. But in the case of links there is no such property which can show that it is disabled. How can we find out if it is disabled or not.

Thanks for the help in advance.

4

A link (A tag) does not respect the "disabled" property as per the HTML spec, so if you have a "disabled" link then your developers have done something special to make it that way. Generally a "disabled" link is either not a link at all (text with styles applied to it such as a blue color and underline) or where the default behavior is overridden via javascript like so:

$('#link').click(function(e){
   e.preventDefault();
});

There are a number of other ways to get the effect as well. In order to determine whether a link is disabled, you would first have to determine how your developers actually faked the behavior of the "disabled" property. Based on what you find out, you may be able to determine whether the link is disabled by checking the class or other properties.

0

In my case if web link is disabled then it appears as WebElement if it is enable then it appears are Link and vice versa. So Using below concepts we can check either Web link is enabled of disbled.

if Browser().Page().WebTable().WebElemnt().exist(0) Then 
      Reporter.reprotevent Micpass, "Link Status", "Link is disabled."

else if Browser().Page().WebTable().Link().exist(0) Then
     Reporter.reprotevent Micpass, "Link Status", "Link is Enabled."
End IF

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.