Forum Discussion

Tamarchik123's avatar
Tamarchik123
New Contributor
2 years ago

Change default co-ordinates in Testcomplete

Hello, In documentation  There is written that 

click on  object works in the corner, can i change default coordinates to click in the center by default, or during clicking on specific text value

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    If ClientX and ClientY is omitted, the click will be simulated in the centre of the object.

     

    If you write a small function to perform a click with and without parameters, you can see the action being performed.

    • Tamarchik123's avatar
      Tamarchik123
      New Contributor

      My objects are popup menu texts and as i catch, by index it is clicked in the center, by text it is clicked down and as a result click is not performed, i want to perform it by text and not by index

  • scottroutesmart's avatar
    scottroutesmart
    Occasional Contributor

    For my x and y coordinates, I used the following snippet of custom code to get it to click in the middle of the object exactly, as I knew I needed to click that exact point for a dialog box to appear...

    Aliases.browser.pagename.canvas.width/2
    Aliases.browser.pagename.canvas.height/2

    The thing I like about doing it this way is that if your object dimensions, browser window size, or other factors change, it calculates the middle point of the object regardless.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Is this a desktop of web application? 

     

    Can you provided your code? So that we can see how you are performing your actions