Ui automation testing right click menus

I am trying to automate testing for wpf application using ui automation. I have problems simulating right mouse click and selecting different option in right click menu. Any suggestions?

I also have problems with running other test written using ui automation. Because they just don't wanna start if I don't have UISpy opened and all programs minimized.


With a lot of browsing I found this solution. It might be helpful to anyone else: UI Automation in Silverlight

Only added simple right click code

public static class Mouse

        private const UInt32 MouseEventLeftDown = 0x0002;
        private const UInt32 MouseEventLeftUp = 0x0004;
        private const UInt32 MouseEventRightDown = 0x0008;
        private const UInt32 MouseEventRightUp = 0x00010;


        private static extern void mouse_event(UInt32 dwFlags, UInt32 dx, UInt32 dy, UInt32 dwData, IntPtr dwExtraInfo);

        public static void Click()
            mouse_event(MouseEventLeftDown, 0, 0, 0, IntPtr.Zero);
            mouse_event(MouseEventLeftUp, 0, 0, 0, IntPtr.Zero);

        public static void RightClick()
            mouse_event(MouseEventRightDown, 0, 0, 0, IntPtr.Zero);
            mouse_event(MouseEventRightUp, 0, 0, 0, IntPtr.Zero);


Need Your Help

Dynamic width div and ellipsis text

css html dynamic width

I'm attempting to place 4 divs floating next to each other, in which the first two must be placed on the left side, the fourth one should be on the right, and the third one must take the width rema...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.