File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -81,5 +81,7 @@ public void TestInitialize()
8181 editBox . SendKeys ( Keys . Delete ) ;
8282 Assert . AreEqual ( string . Empty , editBox . Text ) ;
8383 }
84+
85+ protected static string SanitizeBackslashes ( string input ) => input . Replace ( "\\ " , Keys . Alt + Keys . NumberPad9 + Keys . NumberPad2 + Keys . Alt ) ;
8486 }
8587}
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public void PopupDialogSaveFile()
3636 session . FindElementByName ( "File" ) . Click ( ) ;
3737 session . FindElementByXPath ( $ "//MenuItem[starts-with(@Name, \" Save As\" )]") . Click ( ) ;
3838 Thread . Sleep ( TimeSpan . FromSeconds ( 1 ) ) ; // Wait for 1 second until the save dialog appears
39- session . FindElementByAccessibilityId ( "FileNameControlHost" ) . SendKeys ( TargetSaveLocation + TestFileName ) ;
39+ session . FindElementByAccessibilityId ( "FileNameControlHost" ) . SendKeys ( SanitizeBackslashes ( TargetSaveLocation + TestFileName ) ) ;
4040 session . FindElementByName ( "Save" ) . Click ( ) ;
4141
4242 // Check if the Save As dialog appears when there's a leftover test file from previous test run
@@ -70,7 +70,7 @@ public static void ClassCleanup()
7070 Assert . IsNotNull ( windowsExplorerSession ) ;
7171
7272 // Navigate Windows Explorer to the target save location folder
73- windowsExplorerSession . Keyboard . SendKeys ( Keys . Alt + "d" + Keys . Alt + TargetSaveLocation + Keys . Enter ) ;
73+ windowsExplorerSession . Keyboard . SendKeys ( Keys . Alt + "d" + Keys . Alt + SanitizeBackslashes ( TargetSaveLocation ) + Keys . Enter ) ;
7474
7575 // Verify that the file is indeed saved in the working directory and delete it
7676 windowsExplorerSession . FindElementByAccessibilityId ( "SearchEditBox" ) . SendKeys ( TestFileName + Keys . Enter ) ;
You can’t perform that action at this time.
0 commit comments