Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error in Code while accessing WPF object
#1
Not Solved
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
Reply
#2
Not Solved
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")
'read the list items and find the 'recordYouNeed':
listItemsCounter = yourList.GetItemsCount
For i = 1 To listItemsCounter        
    'retrieve items values:
    itemValue = yourList.GetItem(i)
    itemSelection = yourList.GetSelection
    'check if retrieved item's value is the expected one:
    If itemValue = "recordYouNeed" Then
        yourList.Select itemValue    'select the item you need
                Reporter.ReportEvent micPass, "The record 'recordYouNeed' successfully found and selected", "more details if needed"
        Exit For
    ElseIf itemValue <> "recordYouNeed" and i = listItemsCounter-1 Then
        Reporter.ReportEvent micFail, "Could not find the record 'recordYouNeed'", "more details if needed"
        ExitTest
    End If
Next
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Error while adding Object to Object repository at run time SaranKumarV 3 8,399 02-02-2015, 01:40 AM
Last Post: dubeyvin
  Error on WPF elements Autobot 2 4,989 12-09-2014, 11:27 AM
Last Post: Autobot
  UFT 11.5 throwing unspecified error while running for Delphi object rakeshsahay 0 3,524 12-25-2013, 10:43 AM
Last Post: rakeshsahay
  Error in below code snippet nilanjans 1 2,731 06-11-2013, 12:42 PM
Last Post: basanth27
  Issue in WPF Automation in QTP 11 Dinesh_cts 3 8,329 09-18-2012, 12:21 AM
Last Post: rnbhushan

Forum Jump:


Users browsing this thread: 1 Guest(s)