Thursday, December 30, 2010

Moving mouse to clickable points

Hi Guys,

This is the way I m using to get the clickable coordinates for the buttons. Please take in account that if the clickable coordinate is inside visual studio frame its likely to fail. You will get the following error :-

NonComVisibleBaseClass was detected
Message: A QueryInterface call was made requesting the class interface of COM visible managed class 'MS.Internal.AutomationProxies.WindowsButton'. However since this class derives from non COM visible class 'MS.Internal.AutomationProxies.ProxyHwnd', the QueryInterface call will fail. This is done to prevent the non COM visible base class from being constrained by the COM versioning rules.


public static Point getClickablepoint(AutomationElement button)
{
System.Windows.Point clickablePoint = new System.Windows.Point();
button.TryGetClickablePoint(out clickablePoint);
//Console.WriteLine(clickablePoint.X.ToString() + "," + clickablePoint.Y.ToString());
int x = (int)clickablePoint.X;
int y = (int)clickablePoint.Y;
return (new Point(x, y));
}


//move mouse pointer to this position
Cursor.Position = getClickablepoint(button);

Node.JS rest api Tutorials