我是White的新手。有人能告诉我如何运行exe文件(带有日志密码)并打印该exe文件中的所有元素吗?
我确实使用了
Application application = Application.Launch("exe /password)"
但它不起作用。
答案 0 :(得分:1)
Elisa的 我假设你想从包含listview或gridview的表单中获取电话号码,并将它们写入文件或其他控件。最重要的是:)这里是
//启动应用
Application app = Application.Launch(“.exe的完整路径”);
//启动应用程序后获取主窗口
Window win = app.GetWindow(Core.UIItems.Finders.SearchCriteria.ByAutomationId(“Form1”),Core.Factory.InitializeOption.NoCache);
//获取list / gridview的白色类型表
var listOfPhonesNumbers = win.Get< Table
>(SearchCriteria.ByAutomationId(“grdPhoneNumber”));
for(int i = 0; i“<”listOfPhoneNumbers.Rows.Count; i ++) { ///将电话号码打印到任何文件 }
答案 1 :(得分:0)
#region lanch App
// source exe file path. here it is calculator exe path
const string ExeSourceFile = @"C:\Windows\system32\calc.exe";
//Global Variable to for Application launch
White.Core.Application _application;
//Global variable to get the Main window of calculator from application.
White.Core.UIItems.WindowItems.Window _mainWindow;
//start process for the above exe file location
var psi = new ProcessStartInfo(ExeSourceFile);
// launch the process through white application
_application = White.Core.Application.AttachOrLaunch(psi);
//Get the window of calculator from white application
_mainWindow = _application.GetWindow
(SearchCriteria.ByText("Calculator"), InitializeOption.NoCache);
#endregion