0

I have .NET desktop application. In my test I open application and click button to open DocWindow (WinWindow). After some actions I want to close DocWindow by [X] button. I tried to record this actions. Recorder generate code:

Mouse.Click(uITheRibbonPropertyPage, new Point(926, 15)); 

uITheRibbonPropertyPage is a control in the top of DocWindow. I think that click on coordinates is not very good idea. How to close WinWindow by some other way?

2
  • Maybe msdn.microsoft.com/en-us/library/… or msdn.microsoft.com/en-us/library/… Commented Apr 18, 2017 at 12:16
  • Window.Close Method () used for Window Class from System.Windows. I need method for WinWindow from Microsoft.VisualStudio.TestTools.UITesting.WinControls. I think this decision not for this situation. Commented Apr 18, 2017 at 15:32

1 Answer 1

1

You can use Alt+F4 to close it.

Keyboard.SendKeys(yourDocWindowObject, "{F4}", ModifierKeys.Alt); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.