I am new to automation using Appium for a C# Desktop application. I have a Username text control on screen which has an Automation Id set on it. When I attempt to click on the username field I receive the error: 'An element command could not be completed because the element is not pointer- or keyboard interactable.'
driver.FindElementByAccessibilityId("UserNameTextBox").Click();
If I add the element to a variable and inspect its properties I can see that it is set as Displayed = False, despite being on screen. I have also injected a wait of 5 seconds to be sure this isn't a timing issue.
If I attempt to use the same technique on the Password field below, it works.
Doing some further debugging, I can see that this has a TagName of Control.Text
var userNameBox = driver.FindElementByAccessibilityId("UserNameTextBox");
and this has a TagName of Control.Edit
var passwordBox = driver.FindElementByAccessibilityId("PasswordBox");
If I use the Inspector.exe it reveals the following properties for the username control:
This code successfully finds the element and clicks on it:
driver.FindElementByClassName("TextBox").Click();
driver.FindElementByClassName("TextBox").SendKeys("joe bloggs");
But this code returns the error.
driver.FindElementByAccessibilityId("UserNameTextBox").Click();
driver.FindElementByAccessibilityId("UserNameTextBox").SendKeys("joe bloggs");
Why? I would rather use Accessibility Id, there is only one instance of TextBox on screen in this example, but it won't be very reliable for other screens.