WinAppDriver - identifying Value.Value property using xpath

∥☆過路亽.° 提交于 2020-02-06 19:31:44

问题


So for our application, there are several places where we are missing automation IDs and just good unique identifiers in general.

In one particular case the only good identifier that I can use is a Value.Value property identified by the Inspect tool.

I tried grabbing this element using a basic xpath command..

FindElementByXPath("//*[@Value.Value='" + value + "']");

But this did not work... Can WinAppDriver use these properties in any way?


回答1:


You can do something like this. If there is a class name, you can get all the controls with the class, and then get attribute Value.Vaue, and perform your operation after finding it.

The code will look something like this.

var elements = WindowsDriver.FindElementsByClassName("<YourClassName>");
    foreach (var element in elements)
        {
                    if (element.GetAttribute("Value.Value") == "Notes")
                    {
                        //Do your stuff
                        //return the element
                    }
                }


来源:https://stackoverflow.com/questions/55928563/winappdriver-identifying-value-value-property-using-xpath

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!