@@ -98,15 +98,16 @@ private static void NavigateDialogPath(IUIAutomationElement window)
9898 }
9999 Debug . WriteLine ( $ "Path: { path } ") ;
100100
101- //_inputSimulator.Keyboard.ModifiedKeyStroke(VirtualKeyCode.MENU, VirtualKeyCode.VK_D);
101+ // Use Alt + D to focus address bar
102+ _inputSimulator . Keyboard . ModifiedKeyStroke ( VirtualKeyCode . MENU , VirtualKeyCode . VK_D ) ;
102103
103104 var address = dialog . FindFirst ( TreeScope . TreeScope_Subtree , _automation . CreateAndCondition (
104105 _automation . CreatePropertyCondition ( UIA_PropertyIds . UIA_ControlTypePropertyId , UIA_ControlTypeIds . UIA_EditControlTypeId ) ,
105106 _automation . CreatePropertyCondition ( UIA_PropertyIds . UIA_AccessKeyPropertyId , "d" ) ) ) ;
106107
107108 if ( address == null )
108109 {
109- // I found issue here
110+ // I found I cannot get address edit control here
110111 Debug . WriteLine ( "Failed to find address edit control" ) ;
111112 return ;
112113 }
@@ -119,6 +120,7 @@ private static void NavigateDialogPath(IUIAutomationElement window)
119120 PInvoke . WM_KEYDOWN ,
120121 ( nuint ) VirtualKeyCode . RETURN ,
121122 IntPtr . Zero ) ;
123+ Debug . WriteLine ( "Send Enter key to address edit control" ) ;
122124 }
123125
124126 private static void WindowSwitch (
@@ -164,33 +166,13 @@ uint dwmsEventTime
164166 continue ;
165167 }
166168
167- // Release previous reference if exists
168- /*if (lastExplorerView != null)
169- {
170- Marshal.ReleaseComObject(lastExplorerView);
171- lastExplorerView = null;
172- }*/
173-
174169 lastExplorerView = explorer ;
175170 }
176171 }
177172 catch ( System . Exception e )
178173 {
179174 Log . Exception ( ClassName , "Failed to get shell windows" , e ) ;
180175 }
181- finally
182- {
183- /*if (window != null)
184- {
185- Marshal.ReleaseComObject(window);
186- window = null;
187- }
188- if (shellWindows != null)
189- {
190- Marshal.ReleaseComObject(shellWindows);
191- shellWindows = null;
192- }*/
193- }
194176 }
195177
196178 public static void Dispose ( )
0 commit comments