Unable to locate a visible and clickable nested element
See original GitHub issueI am trying to locate an element in the GUI of WPF application, using WinAppDriver and Selenium. The XPath of the element looks like this:
"/Pane[@ClassName="ClassName1"][@Name="Name1"]/Window[@Name="Name2"][@AutomationId="AutomationId1"]/Custom[@ClassName="ClassName2"]/Custom[@AutomationId="AutomationId2"]/Custom[@AutomationId="AutomationId3"]/Custom[@AutomationId="AutomationId4"]/Custom[@AutomationId="AutomationId5"]/Group[@Name="Group"][@AutomationId="GroupAutoId"]/Custom[@ClassName="ClassName3"]/Pane[@ClassName="ClassName4"]/Text[@Name="elementToLocate"][@AutomationId="elementToLocateAutoId"]"
However, even though the element is clearly visible and clickable in the GUI of the app and in UIRecorder, WinAppDriver is not able to locate it. The parent element ‘Group’ can be located without any issue. I also tried to locate the element under the parent element ‘Group’ using relative xpath, but it couldn’t be located that way either. When logging the whole tree structure of elements recursively, the ‘elementToLocate’ is not present. It’s also worth to mention that in the past, the same test code and xpath has located the element successfully, but it stopped working without making any changes to the test code or version of the app. I have tested this problem with WinAppDriver v1.2.1 and v1.3, but the problem persists for both. I also tried to set ms:experimental-webdriver capability to true, but it didn’t help. Can you please help me understand why this might be happening or what next steps could I try to locate the element successfully?
Issue Analytics
- State:
- Created 8 months ago
- Comments:10
Top GitHub Comments
MichaelSvejcar Check app pagesource: Session.PageSource Then check your xpath using http://xpather.com/ Sometimes really visible controls Session.PageSource for WinAppDriver is diff from Inspector.exe
MichaelSvejcar Please provide the code sample that you are using and WinAppDriver logs