के साथ डेटाग्रिड सामग्री मुझे UI ऑटोमेशन का उपयोग करके बाहरी एप्लिकेशन में डेटाग्रिड की सामग्री पढ़ने में कुछ परेशानी हो रही है और कुछ पॉइंटर्स का उपयोग कर सकता है।यूआई ऑटोमेशन और .net
int id = System.Diagnostics.Process.GetProcessesByName("Book")[0].Id;
AutomationElement desktop = AutomationElement.RootElement;
AutomationElement bw = desktop.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.ProcessIdProperty, id));
AutomationElement datagrid = bw.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.AutomationIdProperty, "lv"));
AutomationElementCollection lines = datagrid.FindAll(TreeScope.Children, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.DataItem));
AutomationElementCollection items = lines[1].FindAll(TreeScope.Children, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Custom));
GridItemPattern pattern = items[1].GetCurrentPattern(GridItemPattern.Pattern) as GridItemPattern;
TableItemPattern tablePattern = items[1].GetCurrentPattern(TableItemPattern.Pattern) as TableItemPattern;
यह रूप में ज्यादा में काम करता है के रूप में मैं GridItemPattern और TableItemPattern से स्तंभ आईडी और पंक्ति आईडी का उपयोग कर सकते, लेकिन मैं मूल्य कि विशेष सेल में है कि कैसे उपयोग करते हैं: यहाँ क्या मैं अब तक राशि है? क्या यह भी संभव है?
धन्यवाद।
धन्यवाद, दुर्भाग्य से मुझे मूल्य पैटर्न को पकड़ने की कोशिश करते समय "असमर्थित पैटर्न" अपवाद मिलता है। यूस्पी केवल ग्रिडइटम और टेबलइटम को वैध पैटर्न के रूप में दिखाता है। कोई अन्य विचार? :) – ChrisO
यह दुखद है = (मेरे परीक्षण अनुप्रयोग में सेल में प्रदर्शित मूल्य सेल के ऑटोमेशन एलेमेंट इंफॉर्मेशन एलिमेंट के नाम फ़ील्ड में भी शामिल था ('आइटम [1]। आपके नमूने के लिए। Current.Name') – Natalia