White doesn't take into account swapped mouse button


White doesn't take into account swapped mouse buttons if it's switched in Windows. Thus if you try to fire RightClick() on element Windows will trasnlate this into just Click()
Closed Jul 28, 2013 at 12:26 PM by JakeGinnivan
Please report the issue on GitHub (https://github.com/TestStack/White) if it is still an issue. Issues raised on CodePlex will not be fixed.
Also include the version of TestStack.White you are using.



bulba wrote Aug 27, 2011 at 5:35 PM

Hello White team,

if it's not worth the time of modifying Mouse class, maybe you can change access level of Mouse.ctor from private to protected?

Roughly speaking I'd be happy to change my

public static class MouseExtension {
    public static void FixedClick(this Mouse mouse) {
        if (WinApi.GetSystemMetrics(WinApi.SM_SWAPBUTTON) == 0) mouse.Click(); else mouse.RightClick();

public static class UIItemExtension {
    public static void FixedClick(this UIItem uiItem) {
        if (WinApi.GetSystemMetrics(WinApi.SM_SWAPBUTTON) == 0) uiItem.Click(); else uiItem.RightClick();
public class FixedMouse : Mouse {
    public static void InstantiateFixedMouse() {
        Instance = new FixedMouse();

    public override void Click() {
        if (WinApi.GetSystemMetrics(WinApi.SM_SWAPBUTTON) == 0) base.Click(); else base.RightClick();

thanks for the library!

wrote Aug 30, 2011 at 6:01 PM

wrote Feb 22, 2013 at 12:22 AM

wrote Jul 28, 2013 at 12:26 PM

JakeGinnivan wrote Jul 29, 2013 at 5:04 PM

This is fixed in vNext actually, thanks for the code (improving a configuration option with your GetSystemMetrics call)