File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -108,17 +108,21 @@ private class FilesTab
108108
109109 public FilesTab ( AutomationElement Files )
110110 {
111- // Find window content to reduce the scope
111+ // Find window content to reduce the scope (Files v3 and earlier)
112112 var _windowContent = Files . FindFirstChild ( cf => cf . ByClassName ( "Microsoft.UI.Content.DesktopChildSiteBridge" ) ) ;
113- var _paneContent = _windowContent . FindFirstChild ( cf => cf . ByClassName ( "InputSiteWindowClass" ) ) ;
113+ _currentPathGet ??= _windowContent . FindFirstChild ( cf => cf . ByAutomationId ( "CurrentPathGet" ) ) ? . AsTextBox ( ) ;
114+ _currentPathSet ??= _windowContent . FindFirstChild ( cf => cf . ByAutomationId ( "CurrentPathSet" ) ) ? . AsTextBox ( ) ;
114115
116+ // Find pane content to reduce the scope (Files v4 and later)
117+ var _paneContent = _windowContent . FindFirstChild ( cf => cf . ByClassName ( "InputSiteWindowClass" ) ) ;
115118 _currentPathGet ??= _paneContent . FindFirstChild ( cf => cf . ByAutomationId ( "CurrentPathGet" ) ) ? . AsTextBox ( ) ;
119+ _currentPathSet ??= _paneContent . FindFirstChild ( cf => cf . ByAutomationId ( "CurrentPathSet" ) ) ? . AsTextBox ( ) ;
120+
121+ // Final check (in case the structure changes in future versions)
116122 if ( _currentPathGet == null )
117123 {
118124 Context . API . LogError ( ClassName , "Failed to find CurrentPathGet" ) ;
119125 }
120-
121- _currentPathSet ??= _paneContent . FindFirstChild ( cf => cf . ByAutomationId ( "CurrentPathSet" ) ) ? . AsTextBox ( ) ;
122126 if ( _currentPathSet == null )
123127 {
124128 Context . API . LogError ( ClassName , "Failed to find CurrentPathSet" ) ;
You can’t perform that action at this time.
0 commit comments