question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to locate a visible and clickable nested element

See original GitHub issue

I 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:open
  • Created 8 months ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
Shakevgcommented, Jan 19, 2023

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

0reactions
Shakevgcommented, Feb 10, 2023

MichaelSvejcar Please provide the code sample that you are using and WinAppDriver logs

Read more comments on GitHub >

github_iconTop Results From Across the Web

NoSuchElementException, Selenium unable to locate ...
The Locator Strategy you have adopted identifies the element but is invisible due to presence of the attribute style="display: none;".
Read more >
How to Fix Selenium's "Element Is Not Clickable at Point"
It means that the element that you're trying to click on can't be clicked at that particular point. You'd usually find this error...
Read more >
Handling ElementNotVisibleException And Element Is Not ...
Above exception says, webdriver is able to locate element, but not able to click on desired element or element is not visible.
Read more >
10 Common Selenium Exceptions in C# and How to Fix Them
The element is hidden. The locator strategy you are using finds more elements with the same locator, and the first one is not...
Read more >
How To Automate Shadow DOM In Selenium WebDriver
When we try to find the Shadow DOM elements using Selenium locators, we get NoSuchElementException as it is not directly accessible to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found