| || |
I am facing a peculiar problem writing testcase for an application where i need to interact with Graphics screen and i have options to Click mouse on the screen or give co-ordinate values. Now Clicking mouse to a desired location is not a fool proof method as it may fail on other Machines, So Specifying Co-ordinates is the right method, but at one place to select co-ordinate it requires to place MOUSE near to the co-ordinate location, Now using Movemouse method is an analog method so is ruled out,
Is there any way to handle this type of situations?? Please Help me.
I too came across such a problem.For that, Using ScrollIntoView ,I scrolled an Unique Object, close to that position I wanted to Click,into view.Then ,leaving the screen in that position, Using Window Locations I recorded the Co-ordinates.Since the co-ordinates are relative to the Object scrolled into view,I think,it would work fine in all machines.Just try this.
...to get the coordinates of any gui use the GetRect() function.
RECT rRect = thisgui.GetRect()
int iX = rRect.xPos
int iY = rRect.yPos
...so there's your coordinates. type RECT also gives you lengths in both x and y so you can pretty much get the coords at any point inside your gui.