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.
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...
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
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...
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
Basanth Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.