Error in Code while accessing WPF object - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others) +--- Thread: Error in Code while accessing WPF object (/Thread-Error-in-Code-while-accessing-WPF-object) |
Error in Code while accessing WPF object - Dinesh_cts - 05-17-2012 Hi, I am getting the below error while using the Automation Pattern property to access the WPFmenu object, Code : Code: Window().WpfWindow().WpfList().AutomationPattern("Selection").GetSelection.GetValue(0) Error : Object required: 'Window().WpfWindow().WpfList()..AutomationPattern(..).GetSelection()' The above code is very inconsistent, sometime it works and most of the time it shows the above error. I am using the below Add-Ins while executing the above code, Web .Net WPF Java Is anyone faced this kind of issue? Your help on this will be highly appreciated. Regards, Dinesh RE: Error in Code while accessing WPF object - lotos - 11-08-2017 Are you trying to retrieve the selection from your object (not sure what your AutomationPatern is and why would you do it that way)? If so then you could use next code to get it: Code: Window().WpfWindow().WpfList().GetSelection This should return the value of the selected item. Or you can use next to identify your objects and then select the item you want: Code: Set yourList = indow().WpfWindow().WpfList("description") |