خرید بک لینک

Vote count: 0

I have a wpf application that can have multiple devices added to it on the home screen of the app. In UFT, I want to be able to loop through and gather all the child objects' names, and then click on the last button by referencing it by it's index value.

The following code gathers all the names, prints them, and assigns to numDevices the index that I want to reference on the last line. I just caot get the last line to click on the correct button. If I directly reference the value as a number into the index, it correctly clicks the last button. I just caot seem to get the syntax correct to use the numDevices variable for the index reference on the last line.

Dim oDesc
Dim numDevices
numDevices = -1
Set oDesc = Description.Create
oDesc("micclass").value = "WpfButton"

'Find all WpfButtons
Set obj = WpfWindow("devname:=X").WpfObject("devname:=ItemsControl").ChildObjects(oDesc)

Dim i
For i = 0 to obj.Count - 1              
  x = obj(i).GetROProperty("name") 
  print x 
  numDevices = numDevices + 1
Next    

wait(1)

reporter.ReportEvent micDone,"numDevices = ", numDevices    

WpfWindow("devname:=X","index:=0").WpfButton("devname:=ui_DeviceHubDataTemplates_ButtonPanel","index:=[&numDevices]").Click

asked 3 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 31 ارديبهشت 1395 ساعت: 0:49

صفحه بندی