WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

FindElementByName using partial text

Open matt-stratt opened this issue 6 years ago • 1 comments

Is this possible? I would like to do something where I can still use the core methods to identify elements such as

FindElementByName FindElementByClassName FindElementByAccesibilityId

But instead of passing in the exact text, I would like to pass in a partial text similar to a contains().

I know that there are ways to do this in XPath, but for whatever reason this is not working. I am certain that my XPath is correct. Is this possible to do with these methods? Has anyone found a way to pass in a partial text? Would be super great if there were methods like

FindElementByPartialName FindElementByPartialClassName FindElementByPartialAccesibilityId

matt-stratt avatar Jun 10 '20 14:06 matt-stratt

No, you would have to use an XPath. What's the XPath that you're using? The following works fine for me, to find a Tab control containing "foo" in the name:

//Tab[contains(@Name, 'foo')]

trashbat avatar Jun 10 '20 18:06 trashbat