2017-03-19 4 views
3

모든 채팅 탭을 포함하여 내 Skype 프로그램의 모든 요소를 ​​가져 오려고하는데 표시되는 항목 만 표시됩니다.AutomationElement가 보이지 않는 요소를 검색하지 않습니다

var window = AutomationElement.RootElement.FindFirst(TreeScope.Subtree, 
       new PropertyCondition(AutomationElement.ClassNameProperty, "tSkMainForm")); 

if (window != null) 
{ 
    var items = window.FindAll(TreeScope.Subtree, Condition.TrueCondition); 
    //DO SOME CODE... 
} 

항목 속성 모든 unvisible 항목을 포함하지 않습니다 (예를 들어, 누군가와 채팅의 내부 세부 사항,의 말을 댄하자) :

코드를 IT. 하지만 Dan과의 채팅이 내 Skype에서 열리면 항목 속성에 Dan과의 채팅 내용이 포함됩니다. 탭이 내 스카 이프에서 열리지 않아도 items 속성에서 채팅 내부 세부 정보를 원합니다.

왜 내 코드가 모든 데이터를 검색하지 못합니까? 모든 데이터 (모든 채팅 탭을 열지 않아도 포함)를 어떻게 얻을 수 있습니까? 모든 GridControl 행을 반복

+2

당신이 요소를 볼 수 있나요 GridControlAutomationPeer의 IScrollProvider 인터페이스 구현을 사용 /en-us/library/windows/desktop/dd318521.aspx)? –

답변

0

, https://msdn.microsoft.com (당신은 표준 UIA 도구 'inspect.exe'를 사용할 때

private void Button_Click_1(object sender, RoutedEventArgs e) { 
      var p = Process.GetProcessesByName(ProcName).FirstOrDefault(x => x != null); 
      if (p == null) { 
       Console.WriteLine("proccess: {0} was not found", ProcName); return; 
      } 
      var root = AutomationElement.RootElement.FindChildByProcessId(p.Id); 
      AutomationElement devexGridAutomationElement = root.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, DevexGridAutomationId)); 
      if (devexGridAutomationElement == null) { 
       Console.WriteLine("No AutomationElement was found with id: {0}", DevexGridAutomationId); 
       return; 
      } 

      var cond = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.DataItem); 
      var devexGridItems = devexGridAutomationElement.FindAll(TreeScope.Descendants, cond); 
      GridPattern gridPat = devexGridAutomationElement.GetCurrentPattern(GridPattern.Pattern) as GridPattern; 
      Console.WriteLine("number of elements in the grid: {0}", gridPat.Current.RowCount); 
     }