Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't Identify on Second loop
#1
Not Solved
He, I writing an qtp script to add users based on a input excel file. The script checks is the user exists and/or if the users contact info exist. If either exists, it writes an exception messages. If the user and contact info does not exist it should add the user and contact info. The problem I have is that it works when adding the first user, but does not when adding a subsequent user. I get the following error message:

Can't identify the object "prfid" (of class weblist). Verify the object matches properties of an object currently displayed in your application.

line 113 "sItemsInUserList=Browser("Browser").Page("Page").WebList("prfid").getroproperty("all items")"

Here is the code. Did add a user change something? The repository should have been recorded many months ago and the first add should have an issue as well, but to new to QTP. Any ideas on how to resolve?


Code:
'Let check if  User exists
Browser("Certificate Error: Navigation_2").Page("Page_9").Link("Profile Classes").Click
Browser("Certificate Error: Navigation_2").Page("Page_3").WebList("classes").Select "User"
Browser("Certificate Error: Navigation_2").Page("Page_3").Image("P_01-over").FireEvent "onmouseover"
Browser("Certificate Error: Navigation_2").Page("Page_3").Image("P_01-over").Click
sItemsInUserList=Browser("Browser").Page("Page").WebList("prfid").getroproperty("all items")
If instr(1,sItemsInUserList,sUser) > 0 Then
    bQTPUserExists=True
Else
Reply
#2
Not Solved
Hi Michael,

From what I could get from the info. provided is

The Page may not be loading as quick as the script runs. Ensure that when the second run happens the Browser("Browser").Page("Page").Object exists. If it is, try using a Sync property to wait for the page and then proceed.

Hope this helps
Reply
#3
Not Solved
Thanks anil2u

I added a waitproperty, but that did not work. It still fails when it tries to check the users on the second iteration. See the code below. The sItemsInLIstBox contain the old value and not the new value. The pop up box with a list of users does appear well before qtp displays the error. The list not contains 1 additional users since we added one in the first iteration. It works when I close and open the bowser on each iteration. Any other suggestion or a better way to do this?

The flow is
first iteration
checkuser - populates sItemInListBox with users 12775 users
checkcontact A - populates sItemInListBox with contains 13591 users
If user and contact do not exist
add user
add contact
seond iteration
checkuser - Fails on the sItemInListBox with users 12775 users

Code:
'Let check if  User exists
Browser("Certificate Error: Navigation_2").Page("Page_9").Link("Profile Classes").Click
Browser("Certificate Error: Navigation_2").Page("Page_3").WebList("classes").Select "User"
Browser("Certificate Error: Navigation_2").Page("Page_3").Image("P_01-over").FireEvent "onmouseover"
Browser("Certificate Error: Navigation").Page("Page_3").Image("P_01-over").Click
Browser("Browser").Page("Page_9").WebList("prfid").WaitProperty "name", "prfid", 10000
sItemInListBox=Browser("Browser").Page("Page").WebList("prfid").getroproperty("all items")
If instr(1,sItemInListBox,sUser) > 0 Then
    bQTPUserExists=True
Else
    bQTPUserExists=False
End If
Browser("Schema Editing").Page("Page").WebButton("Cancel").Click
'Lets check if the user DexContact exists
Browser("Certificate Error: Navigation").Page("Page_2").Link("Profile Classes").Click
Browser("Certificate Error: Navigation").Page("Page_3").WebList("classes").Select "DexContact"
Browser("Certificate Error: Navigation").Page("Page_3").Image("P_01-over").FireEvent "onmouseover"
Browser("Certificate Error: Navigation").Page("Page_3").Image("P_01-over").Click
Browser("Browser").Page("Page_9").WebList("prfid").WaitProperty "name", "prfid", 10000
sItemInListBox=Browser("Browser").Page("Page").WebList("prfid").getroproperty("all items")
If instr(1,sItemInListBox,sDexContact) > 0 Then
    bQTPDexContactExists=True
Else
    bQTPDexContactExists=False
End If

Browser("Schema Editing").Page("Page").WebButton("Cancel").Click
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to end script in QTP if the Do Until loop goes to infinite. uma87 3 9,604 09-30-2011, 02:38 PM
Last Post: rajpes

Forum Jump:


Users browsing this thread: 1 Guest(s)