How to get the current location of the Mouse

5 posts, 1 answers
  1. Kiran
    Kiran avatar
    56 posts
    Member since:
    Dec 2008

    Posted 20 Jul 2010 Link to this post

    Hi,

    I am using WebAii 2.0 for UI testing.
    I would like to know how can i get the current mouse location.

    Thanks
    Kiran
  2. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 21 Jul 2010 Link to this post

    Hello kiran,

    That is an interesting request but unfortunately there is no public API to achieve that yet. I'll log a feature request so that we can expose some method or property to get that in future version of the framework.

    How critical is that issue for you? Can you also elaborate on the test scenario you need this for?

    Greetings,
    Konstantin Petkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Kiran
    Kiran avatar
    56 posts
    Member since:
    Dec 2008

    Posted 21 Jul 2010 Link to this post

    Hi Konstantin Petkov,

    Actually i neded to automate a flash application ( Farm Ville Game in Facebook).
    But WebAii cant do that. So what i am planning is to make a utility Program through which i can define a boundary using mouse movement.

    After this i will divide this boundary into equal number of Squares. And then i need to clik on the center of each square.
    This is for automating ploughing, seeding and harvesting actions of Farmville game.

    Is there any other mechanism through which i can get the current mouse location.

    Thanks
    Kiran

  4. Answer
    Nikolai
    Admin
    Nikolai avatar
    85 posts

    Posted 21 Jul 2010 Link to this post

    Hi kiran,

     In order to get the Mouse pointer position you can use the static Position property in System.Windows.Forms.Cursor class.

    In order to do this follow these steps:
    1. Add Reference to System.Windows.Forms dll to your project
    2. Here is the code that will get the current mouse pointer:

    var point = System.Windows.Forms.Cursor.Position;

    Hope this helps.

    Greetings,
    Nikolai
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Kiran
    Kiran avatar
    56 posts
    Member since:
    Dec 2008

    Posted 24 Jul 2010 Link to this post

    Hi Nikolai,

    The code provided by you is working for me.
    I am marking this thread as answered.

    Thanks
    Kiran
Back to Top