happenbiz's avatar
happenbiz
Senior Member
9 years ago
Status:
New Idea

Easier way to locate X&Y co-ordinates

Within my script, I usually program a click on certain fields or other sections using the Click function. For example, wJob.Click( 35, 20 ). However, when I want to enter a new script command using the Click function, in order to find out the X&Y co-ordinates of the item I want to click, I have to use the "Record Script" option in TestComplete to find the X&Y co-ordinates, which actually works but is very slow and time consuming.

 

Therefore, is it possible to have an option that when you click an item, anywhere in my software program, and I can get the X&Y co-ordinate/position immediately? Alternatively, a new feature could be that when you click the new menu option within TestComplete to get X&Y and then you use your mouse to hover above any of the items, then the X&Y position and the Name of the item will be displayed in a bubble screen next to the mouse's cursor. Similar to the Object Spy feature but with a X&Y co-ordinates as well. This also eliminates the need to go to the Object Browser or Object Spy to find the item's name that you want to use the Click function for.

 

My suggestion above or something similar like that, will save a lot of time trying to figure out what numbers I should enter into the Click function.

 

Thank you for reading this.

  • Ravik's avatar
    Ravik
    Super Contributor

    1- Location of x & y cordinate

     

    x= Aliases.PageObject.myObject.Right

    y= Aliases.PageObject.myObject.Top

     

    OR

    We can use Low Level recording, -- Click on Record --> Low level record --> Record Low Level Procedure(Screen Coordinates) or Record Low Level Procedure(Window Coordinates)

     

    2- Displayed in a bubble screen next to the mouse's cursor - is a nice Idea

  • Thank you for your input Ravik.

    I personally think the bubble option is the easiest and most convenient for us testers as it gives you the result in an instant and it changes as you move the mouse. Very quick to get the solution too. If you have multiple objects, like a Panel or data field, then you could possibly alternate between them, with a click of the mouse, in order to get the different X&Y co-ordinates for the multiple objects.

    Alternatively, you could just click anywhere on a screen and a list will appear specifying each available objects X&Y co-ordinates for that particular position. It could display one object or many objects depending on the available objects focused at that point in the screen. Then within your program scripts, you can decide which object you want to use to activate the Click function. Currently, the Record Script option only finds one object's X&Y but there could be multiple solutions from multiple objects which are not available to view.

    Hopefully, something simple and quick will be available soon.

  • Most of the time I do not specify any co-ordinates in Click which means that click must be performed at the center of the object. In KDT just set (-1, -1). Could you describe why do you need specific co-ordinates for Click?

  • I have been converting some old code to change from X&Y to actually specifying the object and then doing a centre click inside which is fine. However, when I have to locate a certain row or column or header within a Grid, then that's one area where I need to know the X&Y co-ordinates so it can click at a certain spot. Also, within certain data fields, you might have some lookup popup menu items within the data field, say on the right side, that need to be clicked and then you would need an X&Y to click them. We even have a field that within the field, expands to a sub menu and beyond so that could also require me to click on a certain location within the field. I am not sure of any other option, for now.