简体   繁体   中英

Coded UI. How to close window?

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?

您可以使用Alt + F4将其关闭。

Keyboard.SendKeys(yourDocWindowObject, "{F4}", ModifierKeys.Alt);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM