cancel
Showing results for 
Search instead for 
Did you mean: 

How to check if a button is Clickable

SOLVED
Highlighted
Occasional Contributor

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:

1. Enabled

2. Disabled

3. IsDisabled

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

 

Any suggestions??

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Verifying if a button is Clickable

Hi,

 

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.

 

Regards,
  /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.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

5 REPLIES 5
Highlighted
Community Leader

Re: Verifying if a button is Clickable

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

 

 

Contributor

Re: Verifying if a button is Clickable

Hi,

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. 

 

Reference to doc: https://support.smartbear.com/testcomplete/docs/app-objects/specific-tasks/standard/button/checking-...

Highlighted
Community Hero

Re: Verifying if a button is Clickable

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".


Robert Martin
[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
Extensions available
Highlighted
Community Hero

Re: Verifying if a button is Clickable

Hi,

 

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.

 

Regards,
  /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.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

Highlighted
Community Manager

Re: Verifying if a button is Clickable

Thanks everyone. Great insights.

 

@testbuilder please mark the best answer as a solution here🙂


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

Changing options from outside of TestComplete

Participate!

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!
Top Kudoed Authors