Wednesday, December 04, 2019

Sample code to open and close Notepad using WhiteX

Sample code to open and close Notepad using WhiteX or TestStack.White.
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();
}
}
}

No comments:

How to configure nfs server on QNX 7.1

How to configure nfs server on QNX 7.1 Target: QNX 7.1 running on a VM (VMware Workstation or VirtualBox). It is assummed that the targets ...