Search code examples
c#.netwinappdriveruitest

RemoteWebElement.SendKeys works on computer 1 but not computer 2?


We have a .NET 6.0 UITest solution that we run in Visual Studio 2022. It starts a WinForm application and tries to set username and password. It does activate and place caret in the boxes and SendKey do work on computer 1 but not computer 2?

I have tried to add Clear and Click before and even manually click the field but it will still not be set by the test.

The version of WinAppDriver.exe is 1.2.2009.2003 on both computers, it is also executed as admin just like VS2022.

Simple code exeample :

var loginForm = session.FindElementByAccessibilityId("frmMain");
var usernameEdit = loginForm?.FindElementByXPath("//Edit[@AutomationId=\"txtUser\"]");
var passwordEdit = loginForm?.FindElementByName("passwordText");
                    
usernameEdit?.SendKeys(optionalUsername.IsNullOrEmpty() ? settings.LoginSettings.OrbitAdminAnvandare.Namn : "TestUser");

passwordEdit?.SendKeys(optionalPassword.IsNullOrEmpty() ? settings.LoginSettings.OrbitAdminAnvandare.Losenord : "TestPassword");

I'm suspecting some kind of rights issues?


Solution

  • This was due to using TeamViewer that probably use a keyboard that do not work with WinAppDriver.exe.