public MarkpadDocument SaveAs(string path) { var directoryName = Path.GetDirectoryName(path); if (!Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } ParentScreen.WhiteWindow.Get <Button>("ShowSave").Click(); ParentScreen.WhiteWindow.Get <Button>("SaveAsDocument").Click(); var modalWindow = ParentScreen.WhiteWindow.ModalWindow("Save As"); modalWindow.Get <TextBox>(SearchCriteria.ByAutomationId("1001")).Text = path; modalWindow.Get <Button>(SearchCriteria.ByAutomationId("1")).Click(); ParentScreen.WaitWhileBusy(); return(this); }