I am currently in the process of automating the UWP application using WinAppDriver/Appium and Selenium WebDriver.
I am facing an issue while getting the value attribute for the text box. I tried getting Legacy Value as well as Value.Value but getting null
WinAppDriverLog:
[4ac9e28c][WindowsDriver@c6ac] Matched '/session/4ac9e28c-e3c9-4a17-bd9a-d1657e8b3c01/element/42.591224.4.5.1.3785/attribute/LegacyValue' to command name 'getAttribute'
[4ac9e28c][WindowsDriver@c6ac] Proxying [GET /session/4ac9e28c-e3c9-4a17-bd9a-d1657e8b3c01/element/42.591224.4.5.1.3785/attribute/LegacyValue] to [GET http://127.0.0.1:4724/wd/hub/session/627D1077-ED95-4D32-BB9B-B1473EEF5817/element/42.591224.4.5.1.3785/attribute/LegacyValue] with no body
[4ac9e28c][WindowsDriver@c6ac] ==========================================
GET /wd/hub/session/627D1077-ED95-4D32-BB9B-B1473EEF5817/element/42.591224.4.5.1.3785/attribute/LegacyValue HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, compress, deflate, br
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Host: 127.0.0.1:4724
User-Agent: appium
[4ac9e28c][WindowsDriver@c6ac] HTTP/1.1 200 OK
Content-Length: 76
Content-Type: application/json
{"sessionId":"627D1077-ED95-4D32-BB9B-B1473EEF5817","status":0,"value":null}
TestCode:
public void verifyValueByName(String locator, String expected) {
WebElement text =WinDriver.driver.findElementByName(locator);
Log.info("Verifying " + expected + " text....");
Assert.assertEquals(text.getAttribute("LegacyValue"), expected); //Legacy|Accessible.Value
Log.info("EXPECTED VALUE: " + expected + " ACTUAL VALUE: " + text.getAttribute("Value.Value"));
}
WinDriver Code
public class WinDriver {
public static WindowsDriver<RemoteWebElement> driver = null;
public static void start(String appPath)
{
Log.info("Setup");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("automationName", "Windows");
capabilities.setCapability("app",appPath);
capabilities.setCapability("platformName", "Windows");
capabilities.setCapability("deviceName", "WindowsMachine");
try {
driver = new WindowsDriver<>(new URL("https://127.0.0.1:4723"), capabilities);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
I am confused as I tried getting “LegacyName” ( as per suggested here>> https://github.com/microsoft/WinAppDriver/blob/a6f3d7bca447e0c13a33f76454600c1fe737ab10/Tests/WebDriverAPI/ElementAttribute.cs#L46%5C%5C>and it worked but unfortunately “LegacyValue” or “Value.Value” does not work.
Thank you all in advance!!!
I tried to fetch the value using WebElement.getAttribute(“Value.Value”) and WebElement.getAttribute(“LegacyValue”). I was expecting to get value using getAttribute