SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 9 of 9
  1. #1
    Junior Member
    Join Date
    Aug 2007
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Rookie Q?: How to check if an object is on page?

    In working with QTP and PeopleSoft 8.9, I am having a problem making QTP check to see if an object exists in my browser. Then based on that result, performing some other action.

    I have a long list of IDs for which I need to delete a particular phone number stored on that ID's record. Here is what the phone data looks like in our application:

    IMAGE

    QTP “sees” each of the Phone fields as follows:
    Business
    Browser("Add/Update a Person").Page("Add/Update a Person").Frame("TargetContent").WebEdit("SCC_PERS_ PHN_H_PHONE$0")

    Home
    Browser("Add/Update a Person").Page("Add/Update a Person").Frame("TargetContent").WebEdit("SCC_PERS_ PHN_H_PHONE$1")

    Mailing
    Browser("Add/Update a Person").Page("Add/Update a Person").Frame("TargetContent").WebEdit("SCC_PERS_ PHN_H_PHONE$2")

    Preferred
    Browser("Add/Update a Person").Page("Add/Update a Person").Frame("TargetContent").WebEdit("SCC_PERS_ PHN_H_PHONE$3")

    But if an ID has only a Home and Preferred phone type, QTP sees those Phone number fields as:
    Home
    Browser("Add/Update a Person").Page("Add/Update a Person").Frame("TargetContent").WebEdit("SCC_PERS_ PHN_H_PHONE$0")

    Preferred
    Browser("Add/Update a Person").Page("Add/Update a Person").Frame("TargetContent").WebEdit("SCC_PERS_ PHN_H_PHONE$1")

    My goal has 3 steps to it:
    1. I want to make QTP check to see if a particular Phone number text box exists on the page (SCC_PERS_PHN_H_PHONE$1~4).
    2. Then I want to check if the value in the text box matches the one in my Data Table.
    3. I want to then click on the delete button associated with that row.

    I am able to write a script that performs steps 2 and 3, but I cannot make it perform step 1 -- the most important step. As mentioned, some IDs will have a row3 and some will not, so i can't program QTP to always delete a certain row because the desired row may be PHONE$0, PHONE$1, PHONE$2, PHONE$3 or even PHONE$4 or 5.

    I have tried using the Exist property, but i'm doing something wrong because QTP just sits for a bit at that step before eventually moving on to the next.

    I programmed it to check if PHONE$3.(“Value”)=Data Sheet but when row3 doesn’t exist, I get a time out error.

    so...can one of you experts help out this n00b. everything i know about QTP has been from what little VBScript i can remember from college years ago and hitting F1. Neither of which is serving me very well here.

    thanks,
    john

  2. #2
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: Rookie Q?: How to check if an object is on pa

    Switch of the Smart identification first and then try the code again.

  3. #3
    Junior Member
    Join Date
    Aug 2007
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Rookie Q?: How to check if an object is on pa

    [ QUOTE ]
    Switch of the Smart identification first and then try the code again.

    [/ QUOTE ]are you serious? it's going to be THAT simple? [img]/images/graemlins/smile.gif[/img] i'll try that this afternoon. thanks.

    john

  4. #4
    Junior Member
    Join Date
    Aug 2007
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Rookie Q?: How to check if an object is on pa

    ok. i made the change you suggested and went with the following code:
    If Browser("Add/Update a Person_2").Page("Add/Update a Person").Frame("TargetContent").WebEdit("SCC_PERS_ PHN_H_PHONE$3").GetROProperty("Value")=DataTable(" phone", dtGlobalSheet) Then
    Browser("Add/Update a Person_2").Page("Add/Update a Person").Frame("TargetContent").Image("Delete row 4 (Alt+8)").Click
    Browser("Add/Update a Person_2").Dialog("Microsoft Internet Explorer").WinButton("OK").Click
    End If


    i get this error:
    Cannot identify the object "SCC_PERS_PHN_H_PHONE$3" (of class WebEdit). Verify
    that this object's properties match an object currently displayed in your application.

    do i need to add back in the bit where i check to see if the webedit field exists first?

    john

  5. #5
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: Rookie Q?: How to check if an object is on pa

    Before using GetROProperty use Exist to check if the object even exists or not.

  6. #6
    Junior Member
    Join Date
    Aug 2007
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Rookie Q?: How to check if an object is on pa

    [ QUOTE ]
    Before using GetROProperty use Exist to check if the object even exists or not.

    [/ QUOTE ]i tried that and i must have coded something incorrectly because it didn't work. i need to get some lunch for now, but i will post up my code when i get back. hopefully, one of you guys will be able to quickly spot the error for me.

    john

  7. #7
    Junior Member
    Join Date
    Aug 2007
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Rookie Q?: How to check if an object is on pa

    If Browser("Add/Update a Person").Page("Add/Update a Person").Frame("TargetContent").WebEdit("SCC_PERS_ PHN_H_PHONE$3").GetROProperty("Exist")=1 Then
    If Browser("Add/Update a Person").Page("Add/Update a Person").Frame("TargetContent").WebEdit("SCC_PERS_ PHN_H_PHONE$3").GetROProperty("Value")=DataTable(" phone", dtGlobalSheet) Then
    Browser("Add/Update a Person").Page("Add/Update a Person").Frame("TargetContent").Image("Delete row 4 (Alt+8)").Click
    Browser("Add/Update a Person").Dialog("Microsoft Internet Explorer").WinButton("OK").Click
    End If
    End If


    that's what i have going. can ya'll tell me what i'm doing wrong?

    john

  8. #8
    Moderator
    Join Date
    Jan 2007
    Location
    Pittsburgh, PA
    Posts
    2,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Rookie Q?: How to check if an object is on pa

    It should be like this.

    If Browser("Add/Update a Person").Page("Add/Update a Person").Frame("TargetContent").WebEdit("SCC_PERS_ PHN_H_PHONE$3").Exist Then
    DataTable("phone", dtGlobalSheet) = Browser("Add/Update a Person").Page("Add/Update a Person").Frame("TargetContent").WebEdit("SCC_PERS_ PHN_H_PHONE$3").GetROProperty("Value")
    Browser("Add/Update a Person").Page("Add/Update a Person").Frame("TargetContent").Image("Delete row 4 (Alt+8)").Click
    Browser("Add/Update a Person").Dialog("Microsoft Internet Explorer").WinButton("OK").Click
    End If

  9. #9
    Junior Member
    Join Date
    Aug 2007
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Rookie Q?: How to check if an object is on pa

    [ QUOTE ]
    It should be like this.

    [/ QUOTE ]awesome! thanks.

    john

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 10:22 AM.

Copyright BetaSoft Inc.