Created
January 2, 2019 06:03
-
-
Save technoscavenger/dd3e467673ce2cc0c51956a2d75d6ee3 to your computer and use it in GitHub Desktop.
Example code to close and open Notepad using WhiteX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
using TestStack.White; | |
using TestStack.White.Factory; | |
using TestStack.White.UIItems.Finders; | |
using TestStack.White.UIItems.MenuItems; | |
using TestStack.White.UIItems.WindowItems; | |
namespace UnitTestProject1 | |
{ | |
[TestClass] | |
public class UnitTest1 | |
{ | |
[TestMethod] | |
public void TestMethod1() | |
{ | |
var applicationName = "notepad.exe"; | |
Application application = Application.Launch(applicationName); | |
var window = application.GetWindow("Untitled - Notepad"); | |
var menubar = window.MenuBars[1]; | |
var file = menubar.MenuItem("File"); | |
file.Click(); | |
var fx = window.Popup; //submenus are implemented as Popup menu for Notepad | |
var exitMenuItem = fx.Item("Exit"); | |
exitMenuItem.Click(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment