cancel
Showing results for 
Search instead for 
Did you mean: 

Testobject.Click doesnt always work

SOLVED
New Contributor

Testobject.Click doesnt always work

I'm testing a web application and I have a few actions on test objects that involve clicking a button or a link to navigate to a different page, or to click a radio button on a page. All of these test objects are mapped in the Name Mapping repository.

 

I'm using a modular framework for this project, and sometimes when I execute the click action on these test objects, TestComplete will show that it clicks the object on the screenshots, but the expected action of navigating to another page (or selecting a radio button) doesn't always happen. 

 

I've tried alternate measures of identifying these objects using TestObject.NativeWebObject.Find, and I'm still experiencing this problem. I changed some project properties to slow down test execution and the problem still occurs. 

 

Any suggestions for ensuring that an objects is clicked when it's specified in the scripts? I'd provide some scripts, but the issue really is just with a simple TestObject.Click. 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: Testobject.Click doesnt always work

Without knowing more detail about the specifics of the objects, my best guess is that the "Click" action is being performed just fine but the object being clicked may not be ready to be clicked... It's present on screen but not enabled, or there's a background process that needs to finish, or something like that.  It has all the earmarks of a "timing" problem where the automation is running faster than the application can perform.  I'd start with adding logic to check the component in question to determine if it is ready to be clicked before executing the click.


Robert Martin
[Community Expert Group]
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
Extensions available

View solution in original post

5 REPLIES 5
Community Hero

Re: Testobject.Click doesnt always work

Without knowing more detail about the specifics of the objects, my best guess is that the "Click" action is being performed just fine but the object being clicked may not be ready to be clicked... It's present on screen but not enabled, or there's a background process that needs to finish, or something like that.  It has all the earmarks of a "timing" problem where the automation is running faster than the application can perform.  I'd start with adding logic to check the component in question to determine if it is ready to be clicked before executing the click.


Robert Martin
[Community Expert Group]
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
Extensions available

View solution in original post

New Contributor

Re: Testobject.Click doesnt always work

 I'll give that a shot! Thanks

Community Hero

Re: Testobject.Click doesnt always work

Hi,

 

Yes, I am completely with Robert - .Click() must work, otherwise this forum had to explode from complaints about not working tests. Smiley Happy But, alas!, the nature of most modern web applications is that there are too many background actions done via scripting on the page and the page well may not respond until all those actions are done. If this is the case, you should find indicators that signal that the page and the given control are ready to interact with end-user and delay your screen actions (clicks, keys typing, drags, etc.) until the page and control are ready.

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members 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. Postings made by [Community Expert Group] members
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.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Occasional Contributor

Re: Testobject.Click doesnt always work

Yes I have the same problem.   One of my test involves search for a contact.  Then when I get the results, I click on the contact name and it should open the contact basic profile information.   But I have noticed that when I run my test and it happens that the first contact appearing on the list of contacts found has an hyperlink with more than one line, the click does not work on my test. 

 

can click on hyperlink with 2 lines.jpg

Highlighted
Community Hero

Re: Testobject.Click doesnt always work

I've had the same issue... the problem is that, basically, a "Click" call with -1 for both the X and Y parameters clicks in the center of the component... which, on that example, is in a blank space and not actually on the link itself.  This is ESPECIALLY the case when I'm clicking the Cell and not the link itself.  What I did to solve this is actually to find the cell and then find the link object INSIDE the cell and click on that.  This makes sure that the link  is clicked and I'm not clicking the blank space in the middle of the cell.


Robert Martin
[Community Expert Group]
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
Extensions available
New Here?
Join us and watch the welcome video:
Top Kudoed Authors