WinAppDriver found the element but could not click because of the "the referenced element is no longer attached to the DOM." exception
When I tried to click on a hyperlink element, it throws the "An element command failed because the referenced element is no longer attached to the DOM." exception, even though the element is displayed on the window that driver is focusing on.
The element is showing in Accessibility Inside as image below:
Here is my code:
var element = driver.FindElementByName("event#LinkId=1");
element.Click();
The exception was thrown at line 2. The same exception was thrown when I tried to use MoveToElement() or element.Location.X.
But it works well if clicking on the parent element:
driver.FindElementByAccessibilityId("linkText").Click();
Another issue, the driver could not find the element if using:
driver.FindElementByXPath("//Document[@AutomationId=\"linkText\"]/Hyperlink[contains(@Name, 'event')]");
Below is some properties of the hyperlink element:
ControlType = Hyperlink(50005)
IsEnabled = True
IsOffscreen = False
IsKeyboardFocusable = False
HasKeyboardFocus = False
Does anyone knows how to fix this issue?

Comments
Post a Comment