none
Getting control information of third party application on mouse click RRS feed

  • Question

  • Hello,

    I am working on a automation project. 

    I want to get the control information [like control id, label etc.] from third party application using mouse click.

    For example, I click on any menu, menu item on that third party application. When this click happens, I want to get that menu item information in my automation project.

    So basically I want to write a mouse click event handler which can get the control information on click basis.

    Could you please shade some light on this? Any example would be of helpful.

    Thank you in advance.

    Navnath

    • Moved by CoolDadTx Wednesday, June 13, 2018 1:34 PM Testing related
    Wednesday, June 13, 2018 6:48 AM

All replies

  • I am using .NET 3.5
    Wednesday, June 13, 2018 6:49 AM
  • You can use a WH_MOUSE_LL hook (or a thread or a timer) and

    IUIAutomation.ElementFromPoint

    (UIAutomationClient, ref. UIAutomationCore.dll)

    (Tested on Windows 10, with VS 2015 and .NET 3.5)

    Wednesday, June 13, 2018 7:36 AM
  • Hello,

    Thank you for the reply.

    But your solution is coordinate based. At any given time, my third party application can be anywhere on the screen. So, coordinates used to get the control information initially may not be useful next time.

    Wednesday, June 13, 2018 9:54 AM
  • You wrote "on mouse click", so you get coordinates from mouse cursor position

    (I tested without mouse click to simplify, just from mouse cursor position , anywhere on the screen (on a button, a menu item, etc...)

    Wednesday, June 13, 2018 11:12 AM
  • I mean, will it be relative to Window?

    If window is resized, will it work the same way?

    Wednesday, June 13, 2018 11:14 AM
  • Yes, it is relative to the screen
    Wednesday, June 13, 2018 11:36 AM