Created
September 2, 2016 18:34
-
-
Save shturm/c438373a82a4ea0c821cd94fc6d7f38b to your computer and use it in GitHub Desktop.
This file contains hidden or 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.Collections.Generic; | |
using System.Linq; | |
// https://www.nuget.org/packages/TestStack.White | |
using TestStack.White; | |
using TestStack.White.UIItems; | |
using TestStack.White.UIItems.Finders; | |
namespace MTBacktester | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Application app = Application.AttachOrLaunch(new System.Diagnostics.ProcessStartInfo(@"C:\Program Files (x86)\MetaTrader 4\terminal.exe")); | |
var windows = app.GetWindows(); | |
var criteria = SearchCriteria.ByText("Expert properties").AndControlType(typeof(Button), WindowsFramework.Win32); | |
windows.Last() // main window | |
.Get<Button>(criteria) // "Expert Properties" button | |
.Click(); | |
windows.Last() // inputs window | |
.Get<Button>(SearchCriteria.ByText("Load")) | |
.Click(); | |
windows.Last() // file choosing dialog | |
.Get<Button>(SearchCriteria.ByText("Cancel")) | |
.Click(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment