Micro Focus QTP (UFT) Forums
Objects inside WpfList - 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 Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Objects inside WpfList (/Thread-Objects-inside-WpfList)

Pages: 1 2 3


Objects inside WpfList - shinji458 - 08-11-2009

Hello,

I'm using QTP 10.0 with .Net, WPF and Web Addins, on a workstation with windows XP SP3, and Framework .Net 3.5 SP1.

The application that I need to test has some WpfList with many columns in there.
My problem is that during my automation scripts, I select a line in a WpfList, and want to have access to strings inside EACH columns on selected lines. BUT with all properties i have tried, I only have access to first result column.

It is'nt enough for me.

Does anyone knows a solution?

Thanks in advance

P.S: You can see in attachment some picture about my problem.


RE: Objects inside WpfList - basanth27 - 08-11-2009

Thanks for the detailed explanation. It helps. Can you post the code with which you were able to obtain the first value ?


RE: Objects inside WpfList - shinji458 - 08-11-2009

Thanks to you to be so quick.

In fact the code is very very simple:

Code:
stSelected = WpfWindow("GTIR").WpfList("selectionListView").GetSelection

MsgBox (stChaineTirSelected)

And it's the same with .GetItem(indexOfMyLine)...

thanks in advance


RE: Objects inside WpfList - basanth27 - 08-13-2009

Shinji458 -
sorry for the late reply. I dont know if you already got a solution for this, but if you have not, would you let me know what does,

wpflist().getcontent display ? and
wpflist().getvisibletext display ? and
wpflist().getitemscount display ?

Let me know the outcome.


RE: Objects inside WpfList - shinji458 - 08-17-2009

Hello, thanks for your help.

Here is in attachment the asked results.

GetItemsCount give me the number of lines VISIBLE in my WpfList.
GetContent give me the first column of selected line.
GetVisibleText give me a huge string with all text visible in my WpfList. It could work this way, but with a very ugly code...

So, what do you think about all that?

thanks


RE: Objects inside WpfList - basanth27 - 08-17-2009

I request you to upload a .Net Spy shot of the object.


RE: Objects inside WpfList - shinji458 - 08-17-2009

Here is in attachment.


RE: Objects inside WpfList - basanth27 - 08-18-2009

Awesome Screenshot. This is how you have to supplement and it will help anyone.

shinji458 -

Anyways, that said, i am not going to say that the below is the solution. I have used my imagination to derieve this code and i hope this will help us to atleast move forward. Lets start and then we will tackle the rest,

Code:
firstitemcount = WpfList().Object.Items.Count
msgbox firstitemcount 'This should return 10...

seconditemcount = WpfList().Object.Items.Item(1).SubItems.Count
msgbox seconditemcount ' This should give you the total columns count

FrstcolItem = wpfList().Object.Items.Item(1).SubItems.Item(1).Text
msgbox FrstcolItem
Let me know what this returns ?? I have just written it based on the spyshot you sent. I hope we make some progress if we havent made already.


RE: Objects inside WpfList - shinji458 - 08-18-2009

thanks again for your help!

The first line of your solution is good, firstItemCount is effectively equals to 10.
But sadly, the second line returns me an error. It seems that the method "SubItems" doesn't exists for the object returned by ".Item(1)"

I have tried many combinations, all based on the idea of the "sub items of first item", without results. I can't find the object's method that can accomplish that. That leads me to a question: How do you find all these methods, like "Items" of "Object"? Auto-Completion doesn't work here, so i don't know what methods are available...

I hope my average english is understable... Wink


RE: Objects inside WpfList - basanth27 - 08-18-2009

shinji458 -
As i said, my imagination is out of bounds. The inability to not have worked with a wpflist is causing time to get you a solution. Okay lets try this way,

Spy the object using the .Net spy. Look for Items property. I have seen your spyshot so i am sure it is there. Besides the Items property you will see Collection as the text. click on Collection and you will see a small box highlight on which you can click. Click on that and it will bring up another window within the spy. Can you screenshot that and upload it now pretty quick.

You have 5 mins from the time you read this post. I will be gone in the next 20 mins, and i want to resolve this before i leave.

The faster you are at it, the faster i am confident of a solution :- )

Never mind your english, you are better than many i have come across :-D