I am used to test Android and IOS in Appium, but now doing some Windows PC application automation, and want to use the same design pattern as in mobile apps - Page Object.
For each element in my app I have automationId
value, and I am trying to assign it using the WindowsFindBy
annoatation, as follows:
@WindowsFindBy(id = "textBoxDirectory")
WebElement textBoxDirectory;
And I event tried using the accessibility value, but get the same result as you can see in driver logs.
@WindowsFindBy(accessibility = "textBoxDirectory")
WebElement textBoxDirectory;
The page constructor does this:
public PageObject(WindowsDriver driver) {
this.driver = driver;
PageFactory.initElements(driver, this);
}
in WinAppDriver log, I see that the driver is trying to find the element by name and not by ID as expected:
{"using":"name","value":"textBoxDirectory"}
HTTP/1.1 404 Not Found
Content-Length: 139
Content-Type: application/json
{"status":7,"value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters."}}
When I try to access the field the primitive way: textBoxDirectory = driver.findElementByAccessibilityId("textBoxDirectory");
I get the element succesfully.
Thanks a lot for your help!