Forum Discussion

mustafayol's avatar
mustafayol
Contributor
3 years ago
Solved

Do I really need the coordinates when I click on an item?

Hi friends,

 

I am testing windows desktop software.

During the tests I use "record and play" method,  and click on certain buttons within the scenario.

 

appTextBoxMaskBox.Click(2, 5);
appTextBoxMaskBox.Click(94, 4); 

 

My question is "Do I really need the coordinates when I click on an item?"

or is there a generic way to click always on the center of the element?

 

Many Thanks

Mustafa

 

  • ideally, you should never have to rely on coordinates when you perform Click() operations on your objects.

    Given that Testcomplete can uniquely identy the objects themselves (easy way to tell is take the object spy and see if it creates a red rectangle around whatever object you want to interact with)

    then you do not need the coordinates parameters within your Click operations.

    the reason for those being recorded may be that TC wants to be as accurate as possible when transcribing your recorded actions, but it is definitely not necessary in alot of cases.

    you can edit it to be blank, or call on default coordinates (with is dead center of the object -1, -1)

    so that would be

    testedObj.Click() 

    or

    testedObj.Click(-1, -1)

2 Replies

  • ideally, you should never have to rely on coordinates when you perform Click() operations on your objects.

    Given that Testcomplete can uniquely identy the objects themselves (easy way to tell is take the object spy and see if it creates a red rectangle around whatever object you want to interact with)

    then you do not need the coordinates parameters within your Click operations.

    the reason for those being recorded may be that TC wants to be as accurate as possible when transcribing your recorded actions, but it is definitely not necessary in alot of cases.

    you can edit it to be blank, or call on default coordinates (with is dead center of the object -1, -1)

    so that would be

    testedObj.Click() 

    or

    testedObj.Click(-1, -1)

    • mustafayol's avatar
      mustafayol
      Contributor

      Many thanks for the answer, I removed all coordinates and scripts still run.

      best regards

      Mustafa