0
爲了保持簡潔,我可以這樣做:鑄造字符串UITestControl
UIRvWindow AppWin = new UIRvWindow();
UITestControl path = new UITestControl();
path = AppWin.UnderlyingClass1.UnderLyingClass2;
IEnumerable<WpfButton> collection = path.GetChildren().OfType<WpfButton>();
foreach(WpfButton button in collection)
{
System.Diagnostics.Trace.WriteLine(button.FriendlyName + " - " + button.DisplayText + " - " + button.Name + " - " + button.AutomationId);
}
這工作得很好,但我希望能夠做到這一點:
UIRvWindow AppWin = new UIRvWindow();
UITestControl path = new UITestControl();
string x = "AppWin.UnderlyingClass1.UnderLyingClass2";
path = x;
IEnumerable<WpfButton> collection = path.GetChildren().OfType<WpfButton>();
foreach(WpfButton button in collection)
{
System.Diagnostics.Trace.WriteLine(button.FriendlyName + " - " + button.DisplayText + " - " + button.Name + " - " + button.AutomationId);
}
基本上,我有一個字符串列表,我想通過一個接一個地運行它們。有沒有辦法做到這一點?
你可能想標記這裏使用的語言 – pcnate
發佈示例代碼:AppWin.UnderlyingClass1.UnderLyingClass2'會有幫助。 嘗試加載反射? –