Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot identify the specified item of the regions object.
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi,
I have 2 dropdown listboxes called region and city/area.
It needs to select one region(Santa Clara) and one city/Area(Sunnyvale).So I put this in the for loop and I am storing the Items in the variable called itemname.
The regions value will get changed,so I used reg expression for this regions.
This is my code
Code:
Browser("MLSListings.com").Page("MLSListings.com").Link("ยป County/Area").Click
Browser("MLSListings.com").Page("MLSListings.com").WebList("regions").Check CheckPoint("regions")
ListSize=Browser("MLSListings.com").Page("MLSListings.com").WebList("regions").GetTOProperty("items count")
For i = 1 To ListSize-1
Itemname =Browser("MLSListings.com").Page("MLSListings.com").WebList("regions").GetItem(i+1)
Browser("MLSListings.com").Page("MLSListings.com").WebList("regions").Select Itemname
.................
If I run the script,I am getting the following error,
Cannot identify the specified item of the regions object.
Confirm that the specified item is included in the object's item collection.

Any Help?

Thank you,
Uma
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
Code:
'loop counter problem!
For i = 1 To ListSize
Itemname =Browser("MLSListings.com").Page("MLSListings.com").WebList("regions").GetItem(i)


'by the way you can directly select items like this
For i = 0 To ListSize-1
Browser("MLSListings.com").Page("MLSListings.com").WebList("regions").select "#"&i
Reply
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
One problem I see (but not the cause of your crash) is that in your loop, "i" starts at "1". Then you set "itemname" to ...GetItem(i+1), so the first element you get is element #2; item #1 gets ignored. Maybe that's by design.

It sound to me like it is getting a value via "GetItem(i+1)" that cannot be selected in the next line for some reason. I ran your code on our test web site on a couple of different dropdowns and it worked OK.

To help you find the error, try changing your code to work like this until you find the problem:

.................
Code:
For i = 1 To ListSize-1
Itemname =Browser("MLSListings.com").Page("MLSListings.com").WebList("regions").GetItem(i+1)
Err.Number=0
On Error Resume Next
Browser("MLSListings.com").Page("MLSListings.com").WebList("regions").Select Itemname
If Err.Number <> 0 Then
    x=1
End If
.................

and set a breakpoint on the line "x=1". When the debugger breaks on that line, you can examine "Itemname" and see what it is. It sounds like when this happens that the value for "Itemname" is not on the list for some reason.
Reply
#4
Solved: 11 Years, 3 Months, 4 Weeks ago
Thank you,both of you for the detailed solution.It was very helpful.I gave On Error Resume Next Statement and used # in Global Data Table.
I gave my global data table values like this
(Previous Values
Region-Column Name
Row1-Santa Clara,
Row2-San Mateo)
Changed values(
Region-Column Name
Row1-#1
Row2-#2)
It worked.
[ REF:Mercury QuickTest Professional User's Guide > Appendixes > Troubleshooting QuickTest Tests > Run Error: Cannot identify item]
Thank you for your time.
Thank You
Uma



Thank you,for both of you for the detailed solution.
It was very help ful.
I gave On Error Resume next and used # in the Global datatable.

PreviousData:
Region-Column Name
Row1:Santa clara
Row2:San Mateo



Region-Column Name
Row1:#2
Row2:#3

[Ref:Mercury QuickTest Professional User's Guide > Appendixes > Troubleshooting QuickTest Tests >
Run Error: Cannot identify item]
Thans for you time
Thank you,
Uma
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Cannot identify the specified item Beginner 0 2,482 06-22-2017, 04:55 PM
Last Post: Beginner
  Cannot identify the object "Webtable" korunu 1 2,539 06-29-2016, 05:28 PM
Last Post: Ankesh
  Cannot identify the object "Webtable" korunu 0 1,806 05-11-2016, 12:02 AM
Last Post: korunu
  WinListView set item command Shahino007 0 2,646 10-06-2015, 03:57 PM
Last Post: Shahino007
  QTP "Cannot identify the object" richardpaulhall_2 3 13,575 08-20-2015, 11:46 PM
Last Post: ADITI1992

Forum Jump:


Users browsing this thread: 3 Guest(s)