Click and LeftClick Default Settings

3 posts, 0 answers
  1. Sonny
    Sonny avatar
    1 posts
    Member since:
    Mar 2012

    Posted 24 Apr 2012 Link to this post

    Is there a way to set the behavior to always use

    OffSet Reference: AbsoluteCenter
    Point Unit: Pixel
    Point X: 0
    Point Y: 0

    So that I don't have to always manually change it every time I create the event?

    Sincerely,

    Sonny
  2. Jonas
    Jonas avatar
    20 posts
    Member since:
    Jun 2012

    Posted 25 Apr 2012 Link to this post

    Hello Sonny,

    One way in doing this is by making one extension on UserInteraction.Click()
    So each time you use click, you can simply use your own extension of click().
    For example:

    public static void Click(this UserInteraction user, ArtOfTest.WebAii.Core.MouseClickType clicktype)
    {
                user.Click(clicktype, value1,value2,value3,value4..);
    }

    The UserInteraction is in the ArtOfTest.WebAii.Silverlight namespace.
    I've attached a file that shows how this will look like when u use it.
    Perhaps there is another sollution out there, but i guess this one will do the trick for you.

    Good luck.

    Best Regards.
    Jonas
  3. Ivaylo
    Admin
    Ivaylo avatar
    781 posts

    Posted 27 Apr 2012 Link to this post

    Hello Sonny,

    You can use this code but please note that extension methods can only be declared in a static class:

    public static void Click(this UserInteraction user, ArtOfTest.WebAii.Core.MouseClickType clicktype)
           {
               user.Click(ArtOfTest.WebAii.Core.MouseClickType.LeftClick, 0, 0, ArtOfTest.Common.OffsetReference.AbsoluteCenter);
           }
    Regards,
    Ivaylo
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top