Open mrlacey opened 4 years ago
You are getting an stale element exception that means the element is no longer part of the DOM i.e. you application is refreshing. You application is refreshing. Can you do a page source after
var moreMenuItems = popupMenu.FindElementsByClassName("Microsoft.UI.Xaml.Controls.NavigationViewItem"); You can do the page source using below:
var pagesource = driver.PageSource; File.WriteAllText("@C:\PageSource.xml",pagesource);
The PageSource shows the extra Window (below) before trying to query the items. I don't see anything obvious that could be an issue but I'm not really sure what I'm looking for.
However, based on comments on the other issue, this appears to be a problem with the control, not something with WinAppDriver.
<Window AcceleratorKey="" AccessKey="" AutomationId="" ClassName="Xaml_WindowedPopupClass" FrameworkId="XAML" HasKeyboardFocus="False" HelpText="" IsContentElement="True" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="False" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="window" Name="Pop-upHost" Orientation="None" ProcessId="19344" RuntimeId="42.265484" x="2713" y="144" width="220" height="356">
<Window AcceleratorKey="" AccessKey="" AutomationId="" ClassName="Popup" FrameworkId="XAML" HasKeyboardFocus="False" HelpText="" IsContentElement="True" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="False" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="window" Name="Pop-up" Orientation="None" ProcessId="19344" RuntimeId="42.265484.4.41" x="0" y="0" width="0" height="0" CanMaximize="False" CanMinimize="False" IsModal="True" WindowVisualState="Normal" WindowInteractionState="Running" IsTopmost="True" IsAvailable="True">
<Pane AcceleratorKey="" AccessKey="" AutomationId="" ClassName="Flyout" FrameworkId="XAML" HasKeyboardFocus="False" HelpText="" IsContentElement="True" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="False" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="pane" Name="" Orientation="None" ProcessId="19344" RuntimeId="42.265484.4.42" x="2713" y="144" width="220" height="356">
<Pane AcceleratorKey="" AccessKey="" AutomationId="" ClassName="ScrollViewer" FrameworkId="XAML" HasKeyboardFocus="False" HelpText="" IsContentElement="True" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="False" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="pane" Name="" Orientation="None" ProcessId="19344" RuntimeId="42.265484.4.43" x="2715" y="162" width="216" height="320" HorizontallyScrollable="False" VerticallyScrollable="False" HorizontalScrollPercent="-1" VerticalScrollPercent="-1" HorizontalViewSize="100" VerticalViewSize="100" IsAvailable="True">
<Group AcceleratorKey="" AccessKey="" AutomationId="TopNavMenuItemsOverflowHost" ClassName="" FrameworkId="XAML" HasKeyboardFocus="False" HelpText="" IsContentElement="True" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="False" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="group" Name="" Orientation="None" ProcessId="19344" RuntimeId="42.265484.4.44" x="2715" y="162" width="216" height="320">
<TabItem AcceleratorKey="" AccessKey="" AutomationId="" ClassName="Microsoft.UI.Xaml.Controls.NavigationViewItem" FrameworkId="XAML" HasKeyboardFocus="True" HelpText="" IsContentElement="True" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="True" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="tab item" Name="Camera" Orientation="None" ProcessId="19344" RuntimeId="42.265484.4.45" x="2715" y="162" width="216" height="80" ExpandCollapseState="Collapsed" IsSelected="False" SelectionContainer="{, , 42.68912.4.1}" IsAvailable="True"/>
<TabItem AcceleratorKey="" AccessKey="" AutomationId="" ClassName="Microsoft.UI.Xaml.Controls.NavigationViewItem" FrameworkId="XAML" HasKeyboardFocus="False" HelpText="" IsContentElement="True" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="True" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="tab item" Name="WebView" Orientation="None" ProcessId="19344" RuntimeId="42.265484.4.47" x="2715" y="242" width="216" height="80" ExpandCollapseState="Collapsed" IsSelected="False" SelectionContainer="{, , 42.68912.4.1}" IsAvailable="True"/>
<TabItem AcceleratorKey="" AccessKey="" AutomationId="" ClassName="Microsoft.UI.Xaml.Controls.NavigationViewItem" FrameworkId="XAML" HasKeyboardFocus="False" HelpText="" IsContentElement="True" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="True" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="tab item" Name="MediaPlayer" Orientation="None" ProcessId="19344" RuntimeId="42.265484.4.49" x="2715" y="322" width="216" height="80" ExpandCollapseState="Collapsed" IsSelected="False" SelectionContainer="{, , 42.68912.4.1}" IsAvailable="True"/>
<TabItem AcceleratorKey="" AccessKey="" AutomationId="" ClassName="Microsoft.UI.Xaml.Controls.NavigationViewItem" FrameworkId="XAML" HasKeyboardFocus="False" HelpText="" IsContentElement="True" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="True" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="tab item" Name="Map" Orientation="None" ProcessId="19344" RuntimeId="42.265484.4.51" x="2715" y="402" width="216" height="80" ExpandCollapseState="Collapsed" IsSelected="False" SelectionContainer="{, , 42.68912.4.1}" IsAvailable="True"/>
</Group>
</Pane>
</Pane>
</Window>
</Window>
When using a WinUI NavigationView in a UWP app with the horizontal mode set to "Horizontal" and more items than can be displayed at once, it's not possible to query the entries displayed in the "Pop-up" that is displayed after clicking the "More" button. I can access the items in the list as a collection, but not click on them or query any of their properties. When I try, I get this response:
I'm using this code:
I have similar code that looks at the contents of a Menu pop-up and that works fine.
It's also possible to query
popupMenu
(in the above code) multiple times and get responses, it's only when I try and query the items that are returned that there is an issue.The following are the details of an example request. I get the list of elements and then immediately request the "Text" property of the first element ("42.3017434.4.45") but that fails. Nothing else has happened
Acknowledging that this may be an issue with the control, I'm cross-posting this in the WinUI repository: https://github.com/microsoft/microsoft-ui-xaml/issues/2736