How to check if a button is Clickable
There is a List of names in a table with pagination on my web page with Previous and Next buttons.
Each page displays 5 results
If there are less than or equal to 5 pages-> Next button is disabled.
I was trying to write a test to see if the button is clickable or not->if it is clickable then Click on it , if not no action
I was trying to use properties Enabled but Enabled always gives me True not matter if the button is disabled or not.
I have tried the following properties. None of them seemed to help:
are there any other properties which could help me differentiate if a button is clickable or not?
I could think of a way to see if button has a link /url behind it but it does not seem to be working as well
Solved! Go to Solution.
Are You use nameMapping?
If naswer is yes then remember to refreshMappingInfo() ob specific object before use property.
"I was trying to use properties Enabled but Enabled always gives me True not matter if the button is disabled or not"
NameMapping is the period of time when the object was assigned to e.g. a variable. If the state of an object changes during a program operation, you have several options:
1. you can read its state directly from the "Object Browser", i.e. you can view the elements declared in the memory of the system in use
2. you refresh the condition of the mapped object and use it
3. you search for the item again with a function such as findxxx() and have a "fresh" object to work on
Enabled is the property used for buttons in test complete to check their state. Maybe a bit more detail would allow someone to help you out.
One of the things I've found is that, especially if it's a web application you're testing, the button ITSELF may not be marked Enabled = false but a parent container object. You might need to look further up the hierarchy to find what is doing the actual "disabling".
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Like Robert wrote...
Web applications are extremely inconsistent and may use dozens of different techniques within the same application to do the same thing: set element itself as disabled, set its parent as disabled (or parent of the parent, or...), change applied class during runtime, ...
The most easy and effective way to answer your question is to ask developers about how this button is disabled.
If developers are not accessible then you will have to spend your time investigating differences between the enabled and disabled button (and its parent(s) ) in the Object Browser to find out the proper indicator.
/Alex [Community Hero]
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
Thanks everyone. Great insights.
@testbuilder please mark the best answer as a solution here🙂
Community and Education Specialist
Hi, I am also facing the same issue which u mentioned. How did u solve it? Could you please help me with the same.
On first page my property is class = "ui-paginator" and last page the property is class = "ui-paginator disabled".
How did you put the loop which doesn't go in infinite. I have used do-while loop so that even through condition is false it should run once.